cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing Organizational Unit info of Portal User

HuseyinBilgen
Active Contributor
0 Kudos

Hi Experts,

Using UME API I can access almost all data of a portal user, but I couldn't find how to access the "Organizational Unit" data of a user. This information is under the "Additional Information" TAB for NW04s.

If anyone faced this issue, plase let me know how to do that.

regards

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HUSEYIN,

Most probably it's accessible only via generic UME IPrincipal API:


userObj.getAttribute(namespace, attrName);

To find out all possible namespaces/attributes use the following:


final StringBuffer result = new StringBuffer();
final String[] namespaces = userObj.getAttributeNamespaces();
for (int i = 0, c = namespaces.length; i < c; i++) {
  final String ns = namespaces<i>;
  final String[] attributes = userObj.getAttributeNames(ns);
  for (int j = 0; k = attributes.length; j < k; j++)
    result.append(ns).append(':').append(attributes[j]).append('n');
}

Then analyze output of result.toString() and try to find out what attribute represents OU.

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

0 Kudos

After running codes, I have this result:

com.sap.security.core.usermanagement : orgunit

orgunit : [Ljava.lang.String;@1e6cafa

How can I get the real org. unit strings?

Former Member
0 Kudos

Altug,

You are getting array of strings, i.e. String[] orgunit (try to cast returned value)

Then you may access individual items via orgunit[idx], most probably you have only orgunit[0] item set, anyway check orgunit.length to make sure how many org. units are returned.

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

0 Kudos

Thank you. Solved...

Answers (0)