use of org.gluu.search.filter.Filter in project oxTrust by GluuFederation.
the class GroupService method searchGroups.
/*
* (non-Javadoc)
*
* @see
* org.gluu.oxtrust.ldap.service.IGroupService#searchGroups(java.lang.String,
* int)
*/
@Override
public List<GluuGroup> searchGroups(String pattern, int sizeLimit) throws Exception {
String[] targetArray = new String[] { pattern };
Filter displayNameFilter = Filter.createSubstringFilter(OxTrustConstants.displayName, null, targetArray, null);
Filter descriptionFilter = Filter.createSubstringFilter(OxTrustConstants.description, null, targetArray, null);
Filter searchFilter = Filter.createORFilter(displayNameFilter, descriptionFilter);
return persistenceEntryManager.findEntries(getDnForGroup(null), GluuGroup.class, searchFilter, sizeLimit);
}
use of org.gluu.search.filter.Filter in project oxTrust by GluuFederation.
the class Fido2DeviceService method getFido2DeviceById.
public GluuFido2Device getFido2DeviceById(String userId, String id) {
GluuFido2Device f2d = null;
try {
String dn = getDnForFido2Device(id, userId);
if (StringUtils.isNotEmpty(userId)) {
f2d = ldapEntryManager.find(GluuFido2Device.class, dn);
} else {
Filter filter = Filter.createEqualityFilter("oxId", id);
f2d = ldapEntryManager.findEntries(dn, GluuFido2Device.class, filter).get(0);
}
} catch (Exception e) {
log.error("Failed to find Fido 2 device with id " + id, e);
}
return f2d;
}
use of org.gluu.search.filter.Filter in project oxTrust by GluuFederation.
the class PersonService method getPersonsByUid.
/*
* (non-Javadoc)
*
* @see org.gluu.oxtrust.ldap.service.IPersonService#getPersonsByUid(java.lang.
* String)
*/
@Override
public List<GluuCustomPerson> getPersonsByUid(String uid, String... returnAttributes) {
log.debug("Getting user information from DB: userId = {}", uid);
if (StringHelper.isEmpty(uid)) {
return null;
}
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<GluuCustomPerson> entries = persistenceEntryManager.findEntries(personDn, GluuCustomPerson.class, userUidFilter, returnAttributes);
log.debug("Found {} entries for userId = {}", entries.size(), uid);
return entries;
}
use of org.gluu.search.filter.Filter in project oxTrust by GluuFederation.
the class PersonService method buildFilter.
private Filter buildFilter(String pattern) {
String[] targetArray = new String[] { pattern };
Filter uidFilter = Filter.createSubstringFilter(OxConstants.UID, null, targetArray, null);
Filter mailFilter = Filter.createSubstringFilter(OxTrustConstants.mail, null, targetArray, null);
Filter nameFilter = Filter.createSubstringFilter(OxTrustConstants.displayName, null, targetArray, null);
Filter ppidFilter = Filter.createSubstringFilter(OxTrustConstants.ppid, null, targetArray, null);
Filter inumFilter = Filter.createSubstringFilter(OxTrustConstants.inum, null, targetArray, null);
Filter snFilter = Filter.createSubstringFilter(OxTrustConstants.sn, null, targetArray, null);
Filter searchFilter = Filter.createORFilter(uidFilter, mailFilter, nameFilter, snFilter, inumFilter, ppidFilter);
return searchFilter;
}
use of org.gluu.search.filter.Filter 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;
}
Aggregations