cancel
Showing results for 
Search instead for 
Did you mean: 

Extended user attributes (UME)

Former Member
0 Kudos

Hi there

I'd like to add some attributes to my application users.

I've read about ume.admin.addattrs and ume.admin.self.addattrs and I got it working, I mean, I can see those attributes in the "user admin" of my was server.

How can I read these values in my webdynpro application?

I've tried through IUser interface but it didn't work.

Is there any other way of adding attributes to WAS users?

thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

That is Ok but I am trying to get those user attributes from a Web Service. This is the code I am running:

IUser user = UMFactory.getUserFactory().getUserByUniqueName(username);
		String[] ns = user.getAttributeNamespaces();
		String[] attr = user.getAttributeNames(ns[0]);

Neither ns nor attr has the attributes I am looking for.

Any ideas?

former_member182372
Active Contributor
0 Kudos

Hi Julio,

Try this

try {
	IUser user = UMFactory.getUserFactory().getUserByUniqueName(username);
	String salesOrg;
	final String[] attribute = user.getAttribute(
		"com.sap.security.core.usermanagement", 
		"NAME_OF_CUSTOM_ATTRIBUTE_FOR_SALES_ORGANIZATION");
	
	if( attribute==null || attribute.length == 0 || !Utils.isNotEmpty(attribute[0]) ) {
	//manage error
		return;
	} else {
		salesOrg = attribute[0];
	}
} catch (final WDUMException e) {
	//manage exception
	return;
}

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

Hi Julio,

I think I found the problem:

I played around with this today and had the same problem. First I was thinking it might be because I tried to use my own namespaces. But in the end I found that <b>the attributes (and namespaces) are only present, if the current user has some values configured</b>, i.e. once you set some value for your custom attributes for a user, if that user logs in, you will also find the attributes.

Regards

Markus

Answers (3)

Answers (3)

Former Member
0 Kudos

Excellent!

That was exactly it.

Thank you

Former Member
0 Kudos

The namespace "com.sap.security.core.usermanagement" does not have the attributte I am specting.

Could you please explain to me the whole procedure for adding custom user attributes?

former_member182372
Active Contributor
0 Kudos

Hm, that`s strange. Try to iterate through

user.getAttributeNamespaces() and user.getAttributeNames() and print all of them to see what kind of attributes you have at all.

former_member182372
Active Contributor
0 Kudos

Hi Julio,

Check

Best regards, Maksim Rashchynski.