Search in sources :

Example 1 with User

use of com.iplanet.ums.User in project OpenAM by OpenRock.

the class DomainComponentTree method getUser.

/**
     * Given identification of a user with a naming
     * attribute and value, lookup the user under a virtual domain specified.
     * For example,
     * 
     * <pre>
     * DomainComponentTree dctree = new DomainComponentTree(ctx,
     *                                           &quot;red.iplanet.com&quot;);
     * 
     * User user = dctree.getUser(&quot;cn&quot;, &quot;Hin Man&quot;, 
     *                                             &quot;red.iplanet.com&quot;);
     * </pre>
     * 
     * @param namingAttribute
     *            Naming attribute for the user object such as "uid" or "mail".
     *            The naming attribute has to provide a unique identifier for
     *            the user.
     * @param value
     *            attribute value for the naming attribute
     * @param domain
     *            Fully qualified domain name such as "red.iplanet.com"
     * @return User object if found
     * @throws DomainNotFoundException
     *             if domain is not found
     * @throws UMSException
     *             upon failure in instantiating the user object
     * @supported.api
     */
public User getUser(String namingAttribute, String value, String domain) throws DomainNotFoundException, UMSException {
    PersistentObject orgEntry = getOrganization(domain);
    SearchResults result = orgEntry.search(namingAttribute + "=" + value, null);
    return (User) result.assertOneEntry();
}
Also used : User(com.iplanet.ums.User) PersistentObject(com.iplanet.ums.PersistentObject) SearchResults(com.iplanet.ums.SearchResults)

Aggregations

PersistentObject (com.iplanet.ums.PersistentObject)1 SearchResults (com.iplanet.ums.SearchResults)1 User (com.iplanet.ums.User)1