Skip to Content
author's profile photo Former Member
Former Member

Searching LDAP using UME APIs

I am trying to search fro users in LDAP using UME APIs and I encountered the following

problems.

I modified the dataSourceConfiguration.XML to search for Custom LDAP Attributes. I added a New attribute called exportControlData in the XML.

1. How do I search for Multiple Attributes? For example I want to search for

UserId=100* , department="XYZ" and exportControlData ="y"

2. How do I retrieve the value for those Custom

Attributes?

For example I search for UserID="100", then I use user.getDispalyName(), user.getEmail(),user.getDepartment() to get the values and dipslay in a table. I also need to display a custom Attribute called exportControlData for UserID=100.

3. When I do a wild card search for UserID (100*) I get SEARCH_RESULT_UNDEFINED. I can successfully do a wild card search lastname, first Name.

Is there a way how I can get this working?

Thanks

lakshmi

Add comment
10|10000 characters needed characters exceeded

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jun 08, 2004 at 05:11 PM

    To display a custom attribute you need to use code similar to:

    String expData[] = user.getAttribute(IPrincipal.DEFAULT_NAMESPACE,"exportControlData");

    if (expData != null)

    displayInfo("Export Data:" , expData[0]);

    You need to have the datasource_xxx.xml file configured to include the attribute:

    <principal type="user">

    <nameSpaces>

    <nameSpace name="com.sap.security.core.usermanagement">

    <attributes>

    <attribute name="firstname" populateInitially="true" />

    <attribute name="displayname" populateInitially="true" />

    <attribute name="lastname" populateInitially="true" />

    . . .

    <attribute name="uniquename" populateInitially="true" />

    <attribute name="exportControlData" />

    </attributes>

    </nameSpace>

    <nameSpace name="com.sap.security.core.usermanagement.relation">

    <attributes>

    <attribute name="PRINCIPAL_RELATION_PARENT_ATTRIBUTE" />

    </attributes>

    </nameSpace>

    </nameSpaces>

    </principal>

    To search for Attribute:

    IUserSearchFilter userFilt =

    UMFactory.getUserFactory().getUserSearchFilter();

    userFilt.setSearchAttribute(IPrincipal.DEFAULT_NAMESPACE,

    "exportControlData","Y",

    ISearchAttribute.EQUALS_OPERATOR,true);

    ISearchResult result = userFact.searchUsers(userFilt);

    ...

    Add comment
    10|10000 characters needed characters exceeded