use of org.gluu.oxtrust.model.GluuCustomPerson in project oxTrust by GluuFederation.
the class ServiceUtil method deleteGroupFromPerson.
/**
* Delete a Group from a Person
*
* @return void
* @throws Exception
*/
public void deleteGroupFromPerson(GluuGroup group, String dn) throws Exception {
List<String> persons = group.getMembers();
for (String onePerson : persons) {
GluuCustomPerson gluuPerson = personService.getPersonByDn(onePerson);
List<String> memberOflist = gluuPerson.getMemberOf();
List<String> tempMemberOf = new ArrayList<String>();
for (String aMemberOf : memberOflist) {
tempMemberOf.add(aMemberOf);
}
for (String oneMemberOf : tempMemberOf) {
if (oneMemberOf.equalsIgnoreCase(dn)) {
tempMemberOf.remove(oneMemberOf);
break;
}
}
List<String> cleanMemberOf = new ArrayList<String>();
for (String aMemberOf : tempMemberOf) {
cleanMemberOf.add(aMemberOf);
}
gluuPerson.setMemberOf(cleanMemberOf);
personService.updatePerson(gluuPerson);
}
}
use of org.gluu.oxtrust.model.GluuCustomPerson in project oxTrust by GluuFederation.
the class BaseScimWebService method getAuthorizedUser.
protected boolean getAuthorizedUser() {
try {
GluuCustomPerson authUser = (GluuCustomPerson) identity.getSessionMap().get(OxTrustConstants.CURRENT_PERSON);
if (authUser == null) {
return false;
}
GluuAppliance appliance = applianceService.getAppliance();
if (appliance == null) {
return false;
}
if (!(GluuBoolean.TRUE.equals(appliance.getScimEnabled()) || GluuBoolean.ENABLED.equals(appliance.getScimEnabled()))) {
return false;
}
return true;
} catch (Exception ex) {
log.error("Exception: ", ex);
return false;
}
}
use of org.gluu.oxtrust.model.GluuCustomPerson in project oxTrust by GluuFederation.
the class PersonService method getPersonString.
/* (non-Javadoc)
* @see org.gluu.oxtrust.ldap.service.IPersonService#getPersonString(java.util.List)
*/
@Override
public String getPersonString(List<GluuCustomPerson> persons) throws Exception {
StringBuilder sb = new StringBuilder();
for (Iterator<GluuCustomPerson> iterator = persons.iterator(); iterator.hasNext(); ) {
GluuCustomPerson call = iterator.next();
sb.append('\'').append(call.getDisplayName()).append('\'');
if (iterator.hasNext()) {
sb.append(", ");
}
}
return sb.toString();
}
use of org.gluu.oxtrust.model.GluuCustomPerson in project oxTrust by GluuFederation.
the class InumService method containsPerson.
public boolean containsPerson(String inum, String gluuInum) {
boolean contains = true;
GluuCustomPerson person = new GluuCustomPerson();
person.setBaseDn(String.format("inum=%s,ou=people,o=%s,o=gluu", inum, gluuInum));
contains = ldapEntryManager.contains(person);
if (contains)
return true;
person.setBaseDn(String.format("inum=%s,ou=people,o=gluu", inum));
contains = ldapEntryManager.contains(person);
return contains;
}
use of org.gluu.oxtrust.model.GluuCustomPerson in project oxTrust by GluuFederation.
the class PersonService method searchPersons.
/* (non-Javadoc)
* @see org.gluu.oxtrust.ldap.service.IPersonService#searchPersons(java.lang.String, int)
*/
@Override
public List<GluuCustomPerson> searchPersons(String pattern, int sizeLimit) {
String[] targetArray = new String[] { pattern };
Filter uidFilter = Filter.createSubstringFilter(OxTrustConstants.uid, null, targetArray, null);
Filter mailFilter = Filter.createSubstringFilter(OxTrustConstants.mail, null, targetArray, null);
Filter nameFilter = Filter.createSubstringFilter(OxTrustConstants.displayName, null, targetArray, null);
Filter inameFilter = Filter.createSubstringFilter(OxTrustConstants.iname, null, targetArray, null);
Filter searchFilter = Filter.createORFilter(uidFilter, mailFilter, nameFilter, inameFilter);
List<GluuCustomPerson> result = ldapEntryManager.findEntries(getDnForPerson(null), GluuCustomPerson.class, searchFilter, 0, sizeLimit);
return result;
}
Aggregations