Skip to Content
avatar image
Former Member

Getting user groups from LDAP

Hi All,

I'm using this code to get the User's group

try

{

IWDClientUser wdUser = WDClientUser.getCurrentUser();

IUser user = wdUser.getSAPUser();

myGroups = user.getAttribute("com.sap.security.core.usermanagement.relation","PRINCIPAL_RELATION_PARENT_ATTRIBUTE");

}

catch{

}

For some users I'm getting "No Text availble " or nullpointer exception.

The code used to run with je22 sp 13 with no problem but after upgrading to SP19, some user get this message !!!

Thanks,

Amit Yosha

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Jun 30, 2007 at 11:22 AM

    Hi Yosha,

    Your NWDS version and WAS version should be same.

    check this thread.

    can-any-one-help-me-with-codingume

    how-to-add-custom-attributes-to-ume

    Regards,

    Mithu

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 01, 2007 at 06:10 AM

    Hi Amit,

    It depends where the attrbiute is being saved:

    1) If it's saved in LDAP you need to check your dataSourceConfiguration file (check that you have the namespace 'com.sap.security.core.usermanagement.relation' and the property 'PRINCIPAL_RELATION_PARENT_ATTRIBUTE' is properly mapped to physical attribute in the LDAP).

    2) If it's saved in the Portal DB, check that the portal actually saves this property for a user (by using setAttribute and then getAttribute...)

    Regards,

    Omri

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 28, 2007 at 02:59 PM

    This code returns the iterator containing the user groups. Once you have called it, you have to loop this iterator while hasnext = false.

    <b> try{

    IWDClientUser clientuser = WDClientUser.getCurrentUser();

    IUser user = clientuser.getSAPUser();

    Iterator userGroups = null;

    userGroups = user.getParentGroups(true);

    }

    catch(Exception ex){

    wdThis.wdGetAPI().getComponent().getMessageManager().raiseMessage( IMessageYSP_CRM_CP_COCKPIT.USER_E , null,true);

    }</b>

    userGroups has the groups.

    Don't forget to loop the iterator in try statement.

    Hopes it can work.

    Grites!

    Add comment
    10|10000 characters needed characters exceeded