Search in sources :

Example 16 with GluuGroup

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

the class GroupService method generateInumForNewGroup.

/* (non-Javadoc)
	 * @see org.gluu.oxtrust.ldap.service.IGroupService#generateInumForNewGroup()
	 */
@Override
public String generateInumForNewGroup() throws Exception {
    GluuGroup group = new GluuGroup();
    String newInum = null;
    do {
        newInum = generateInumForNewGroupImpl();
        String newDn = getDnForGroup(newInum);
        group.setDn(newDn);
    } while (ldapEntryManager.contains(group));
    return newInum;
}
Also used : GluuGroup(org.gluu.oxtrust.model.GluuGroup)

Example 17 with GluuGroup

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

the class GroupService method addGroup.

/* (non-Javadoc)
	 * @see org.gluu.oxtrust.ldap.service.IGroupService#addGroup(org.gluu.oxtrust.model.GluuGroup)
	 */
@Override
public void addGroup(GluuGroup group) throws Exception {
    GluuGroup displayNameGroup = new GluuGroup();
    displayNameGroup.setDisplayName(group.getDisplayName());
    List<GluuGroup> groups = findGroups(displayNameGroup, 1);
    if (groups == null || groups.size() == 0) {
        ldapEntryManager.persist(group);
    } else {
        throw new DuplicateEntryException("Duplicate displayName: " + group.getDisplayName());
    }
}
Also used : DuplicateEntryException(org.gluu.site.ldap.exception.DuplicateEntryException) GluuGroup(org.gluu.oxtrust.model.GluuGroup)

Example 18 with GluuGroup

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

the class GroupService method getGroupByIname.

/* (non-Javadoc)
	 * @see org.gluu.oxtrust.ldap.service.IGroupService#getGroupByIname(java.lang.String)
	 */
@Override
public GluuGroup getGroupByIname(String iname) throws Exception {
    GluuGroup group = new GluuGroup();
    group.setBaseDn(getDnForGroup(null));
    group.setIname(iname);
    List<GluuGroup> groups = ldapEntryManager.findEntries(group);
    if ((groups != null) && (groups.size() > 0)) {
        return groups.get(0);
    }
    return null;
}
Also used : GluuGroup(org.gluu.oxtrust.model.GluuGroup)

Example 19 with GluuGroup

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

the class GroupService method getGroupByDisplayName.

/* (non-Javadoc)
	 * @see org.gluu.oxtrust.ldap.service.IGroupService#getGroupByDisplayName(java.lang.String)
	 */
@Override
public GluuGroup getGroupByDisplayName(String DisplayName) throws Exception {
    GluuGroup group = new GluuGroup();
    group.setBaseDn(getDnForGroup(null));
    group.setDisplayName(DisplayName);
    List<GluuGroup> groups = ldapEntryManager.findEntries(group);
    if ((groups != null) && (groups.size() > 0)) {
        return groups.get(0);
    }
    return null;
}
Also used : GluuGroup(org.gluu.oxtrust.model.GluuGroup)

Example 20 with GluuGroup

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

the class InumService method containsGroup.

public boolean containsGroup(String inum, String gluuInum) {
    boolean contains = true;
    GluuGroup group = new GluuGroup();
    group.setBaseDn(String.format("inum=%s,ou=groups,o=%s,o=gluu", inum, gluuInum));
    contains = ldapEntryManager.contains(group);
    if (contains)
        return true;
    group.setBaseDn(String.format("inum=%s,ou=groups,o=gluu", inum));
    contains = ldapEntryManager.contains(group);
    return contains;
}
Also used : GluuGroup(org.gluu.oxtrust.model.GluuGroup)

Aggregations

GluuGroup (org.gluu.oxtrust.model.GluuGroup)33 EntryPersistenceException (org.gluu.site.ldap.persistence.exception.EntryPersistenceException)15 DuplicateEntryException (org.gluu.site.ldap.exception.DuplicateEntryException)13 ArrayList (java.util.ArrayList)10 Produces (javax.ws.rs.Produces)8 Response (javax.ws.rs.core.Response)8 VirtualListViewResponse (org.xdi.ldap.model.VirtualListViewResponse)7 URI (java.net.URI)6 ScimGroup (org.gluu.oxtrust.model.scim.ScimGroup)6 Group (org.gluu.oxtrust.model.scim2.Group)6 GET (javax.ws.rs.GET)4 Path (javax.ws.rs.Path)4 Date (java.util.Date)3 Consumes (javax.ws.rs.Consumes)3 DefaultValue (javax.ws.rs.DefaultValue)3 HeaderParam (javax.ws.rs.HeaderParam)3 PersonRequiredFieldsException (org.gluu.oxtrust.exception.PersonRequiredFieldsException)3 GluuCustomPerson (org.gluu.oxtrust.model.GluuCustomPerson)3 ApiOperation (com.wordnik.swagger.annotations.ApiOperation)2 IOException (java.io.IOException)2