cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing custom ume attributes.

Former Member
0 Kudos

Hello,

I am using this code to set and get custom ume attributes:


String[] phoneExt={wdContext.currentInputValuesElement().getPhone_Ext().toString().trim()};
newUser.setAttribute("com.sap.security.core.usermanagement","phone_ext", phoneExt);


String[] phoneExt = searchedUser.getAttribute("com.sap.security.core.usermanagement","phone_ext");
String ext = "";
for(int j=0; j<phoneExt.length; j++){
   ext = phoneExt[j];
   break;							 
}

This doesn't seem to work. Can anybody let me know the correct way.

Is it possible to change a portal user's login Id by using API. Can anybody provide the code for this.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Please see the below thread for help

Former Member
0 Kudos

Hi Sameer,

Thanks for your reply.

I am able to set the custom ume attribute using this code:


String phoneExt[] ={wdContext.currentInputValuesElement().getPhone_Ext().toString().trim()};
newUser.setAttribute("com.sap.security.core.usermanagement","phone_ext", phoneExt);

But when I try to read the attributes under "com.sap.security.core.usermanagement", I don't see the custom attribute "phone_ext"


 Before entering attribute: uniquename 
 
 Before entering attribute: office_num 
 
 Before entering attribute: displayname 
 
 Before entering attribute: jobtitle 
 
 Before entering attribute: company 
 
 Before entering attribute: locale 
 
 Before entering attribute: lastname 
 
 Before entering attribute: LAST_MODIFIED_BY 
 
 Before entering attribute: dn 
 
 Before entering attribute: kpnprefix 
 
 Before entering attribute: PRINCIPAL_MODIFY_DATE 
 
 Before entering attribute: krb5principalname 
 
 Before entering attribute: firstname 
 
 Before entering attribute: description 
 
 Before entering attribute: email 
 

I see following values in config tool under ume.admin.addattrs: "krb5principalname;kpnprefix;dn;com.greenheck.usermgt:office_num;phone_ext"

What could be wrong.

Thanks

Tony.

Former Member
0 Kudos

Waht is "newUser"?

Former Member
0 Kudos

I am using namespaces in the code:


					//get custom phone_ext attribute
						String namespaces[] = searchedUser.getAttributeNamespaces();
						String ns = null;
						for (int i = 0; i < namespaces.length; i++) {
							if (i > 0)
								ns = namespaces[ i ];
							String attrNames[] = searchedUser.getAttributeNames(ns);
							if (ns != null){							
								g_message_manager.reportSuccess("NS: " + ns);
						 if(ns.equals("com.sap.security.core.usermanagement")){	
							
							for (int j = 0; j < attrNames.length; j++) {
								if(attrNames[j].equals("phone_ext")){								
									g_message_manager.reportSuccess("\n" + attrNames[j] + " = ");
									Object attr[] = searchedUser.getAttribute(ns, attrNames[j]);
									for (int k = 0; k < attr.length; k++){
										if(!(null == attr[k])|| !(attr[k].toString().length() == 0))									
											searchResult.setPhone_Ext(attr[k].toString());
										break;
									}		
								}else
									continue;			
																
							}
						 }else
						 	continue;
							}
						}			

This doesn't seem to work. Can any body point the right way.