cancel
Showing results for 
Search instead for 
Did you mean: 

How to read "Customixed Information" in UME using WebDynpro Java APIs

Former Member
0 Kudos

Dear All

In our Portal UME we have defined 3 custom fields that appear in the "Customized Information"

tab in the standard Portal "Identity Mangagement" application ie:

krb5principalname :

How can I retrieve the custom fields and values using WebDynpro APIs?

I have the following basic code to retrieve the standard user session information, but

do not know how to extend it to extract the values of the custom fields.

Full points will be awarded to whoever answers question with suggestion that works.

Many thanks in advance

Mike

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Dear All

In our Portal UME we have defined 3 custom fields that appear in the "Customized Information"

tab in the standard Portal "Identity Mangagement" application ie:

krb5principalname : <Value 1>

kpnprefix: <Value 2>

dn: <Value3>

How can I retrieve the custom fields and values using WebDynpro APIs?

I have the following basic code to retrieve the standard user session information, but

do not know how to extend it to extract the values of the custom fields:

// get the logged in user mail id

IWDClientUser clientUser = WDClientUser.getLoggedInClientUser();

IUser user = clientUser.getSAPUser();

wdContext.currentContextElement().setUserid(user.getUniqueID());

wdContext.currentContextElement().setFirstname(user.getFirstName());

wdContext.currentContextElement().setLastname(user.getLastName());

wdContext.currentContextElement().setEmail(user.getEmail());

Full points will be awarded to whoever answers question with suggestion that works.

Many thanks in advance

Mike

Former Member
0 Kudos

Have you tried using the getAttribute() method that IUser inherits from IPrincipal?

public String[] getAttribute(String namespace, String name)

I imagine the namespace would be null, but you can also interrogate the attributes of the IUser object using the following two methods:

public String[] getAttributeNamespaces()
public String[] getAttributeNames(String namespace)

Former Member
0 Kudos

Hi Mike,

Following code is for just one custom attribute <custom attribute>

						String namespaces[] = umeUser.getAttributeNamespaces();
						String ns = null;
						for (int i = 0; i < namespaces.length; i++) {
							if (i > 0)
								ns = namespaces[ i ];
							String attrNames[] = umeUser.getAttributeNames(ns);
							if (ns != null){							
						 if(ns.equals("<name-space>")){	
							
							for (int j = 0; j < attrNames.length; j++) {
								if(attrNames[j].equals("<custom attribute>")){								
									Object attr[] = umeUser.getAttribute(ns, attrNames[j]);
									for (int k = 0; k < attr.length; k++){
										if(!(null == attr[k])|| !(attr[k].toString().length() == 0)){										
											//attr[k].toString() has the custom attribute value
										}
										break;
									}		
								}else
									continue;			
																
							}
						 }else
							continue;
							}
						}	

Where <name-space> is the same value you set in config tool or on portal UME configuration.

Config Tool: Global Service Configuration>services->com.sap.security.core.ume.service>ume.virtual_groups.user_attribute.namespace

Portal

System Administration>System Configuration>UME configuration> User Admin UI tab>

Custom attributes of the user profile

Administrator-Managed Custom Attributes: add ;<name-space>:<custom-attribute>

Hope this helps

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello Bim

I am not really an expert either, however identified the attribute names I required as follows:

1) Values require were store in corporate LDAP

2) In Portal, assign User Management to yourself and select Identity Management service

3) Search for user who you know has the attributes stored against them

4) Customised attributes are visible in tab "Customised Information" (this wil have no entries by default)

5) Attributes will be listed by <namespace>:<attribute>

In my circumstance, we do not have a namespace so the value is kept blank.

I hope this helps

Mike

Former Member
0 Kudos

Code required was very simple:

IWDClientUser clientUser = WDClientUser.getLoggedInClientUser();

IUser user = clientUser.getSAPUser();

String[] names = user.getAttributeNamespaces();

String[] parameter1 = user.getAttribute(names[0], "dn");

Thanks for the pointers. Question closed.

Former Member
0 Kudos

Hi Michael,

I need to do something very similar as we need to extract custom fields from EP6 to EP7.

Where would I need to define the code you have mentioned above?

If, for example, my customized attribute was called "customer_location", where would it be placed (I have limited Java knowledge!):

IWDClientUser clientUser = WDClientUser.getLoggedInClientUser();

IUser user = clientUser.getSAPUser();

String[] names = user.getAttributeNamespaces();

String[] parameter1 = user.getAttribute(names[0], "dn");

Thanks in advance,

Bim!