Search in sources :

Example 1 with SimplePerson

use of org.gluu.oxtrust.model.SimplePerson in project oxTrust by GluuFederation.

the class PersonService method getUserByUid.

/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.gluu.oxtrust.ldap.service.IPersonService#getUserByUid(java.lang.String)
	 */
@Override
public User getUserByUid(String uid) {
    String personDn = getDnForPerson(null);
    Filter userUidFilter;
    if (dataSourceTypeService.isSpanner(personDn)) {
        userUidFilter = Filter.createEqualityFilter(OxConstants.UID, StringHelper.toLowerCase(uid));
    } else {
        userUidFilter = Filter.createEqualityFilter(Filter.createLowercaseFilter(OxConstants.UID), StringHelper.toLowerCase(uid));
    }
    List<SimplePerson> users = persistenceEntryManager.findEntries(personDn, SimplePerson.class, userUidFilter, 1);
    if ((users != null) && (users.size() > 0)) {
        return persistenceEntryManager.find(User.class, users.get(0).getDn());
    }
    return null;
}
Also used : Filter(org.gluu.search.filter.Filter) SimplePerson(org.gluu.oxtrust.model.SimplePerson)

Aggregations

SimplePerson (org.gluu.oxtrust.model.SimplePerson)1 Filter (org.gluu.search.filter.Filter)1