Search in sources :

Example 11 with GluuGroup

use of io.jans.scim.model.GluuGroup in project jans by JanssenProject.

the class Scim2GroupService method preCreateGroup.

public GluuGroup preCreateGroup(GroupResource group, boolean skipMembersValidation, boolean fillDisplay, String usersUrl) throws Exception {
    log.info("Preparing to create group {}", group.getDisplayName());
    GluuGroup gluuGroup = new GluuGroup();
    transferAttributesToGroup(group, gluuGroup, skipMembersValidation, fillDisplay, usersUrl);
    assignComputedAttributesToGroup(gluuGroup);
    return gluuGroup;
}
Also used : GluuGroup(io.jans.scim.model.GluuGroup)

Example 12 with GluuGroup

use of io.jans.scim.model.GluuGroup in project jans by JanssenProject.

the class GroupWebService method checkDisplayNameExistence.

private void checkDisplayNameExistence(String displayName, String id) throws DuplicateEntryException {
    // Validate if there is an attempt to supply a displayName already in use by a
    // group other than current
    GluuGroup groupToFind = new GluuGroup();
    groupToFind.setDisplayName(displayName);
    List<GluuGroup> list = groupService.findGroups(groupToFind, 2);
    if (list != null && list.stream().anyMatch(g -> !g.getInum().equals(id))) {
        throw new DuplicateEntryException("Duplicate group displayName value: " + displayName);
    }
}
Also used : StringUtils(org.apache.commons.lang.StringUtils) Produces(javax.ws.rs.Produces) QUERY_PARAM_FILTER(io.jans.scim.model.scim2.Constants.QUERY_PARAM_FILTER) URISyntaxException(java.net.URISyntaxException) Path(javax.ws.rs.Path) QUERY_PARAM_SORT_ORDER(io.jans.scim.model.scim2.Constants.QUERY_PARAM_SORT_ORDER) BaseScimResource(io.jans.scim.model.scim2.BaseScimResource) MediaType(javax.ws.rs.core.MediaType) SCIMException(io.jans.scim.model.exception.SCIMException) QueryParam(javax.ws.rs.QueryParam) Consumes(javax.ws.rs.Consumes) DefaultValue(javax.ws.rs.DefaultValue) HeaderParam(javax.ws.rs.HeaderParam) GluuGroup(io.jans.scim.model.GluuGroup) PatchOperation(io.jans.scim.model.scim2.patch.PatchOperation) URI(java.net.URI) DELETE(javax.ws.rs.DELETE) SortOrder(io.jans.orm.model.SortOrder) Predicate(java.util.function.Predicate) PatchRequest(io.jans.scim.model.scim2.patch.PatchRequest) QUERY_PARAM_EXCLUDED_ATTRS(io.jans.scim.model.scim2.Constants.QUERY_PARAM_EXCLUDED_ATTRS) GroupResource(io.jans.scim.model.scim2.group.GroupResource) List(java.util.List) Response(javax.ws.rs.core.Response) ErrorScimType(io.jans.scim.model.scim2.ErrorScimType) Scim2PatchService(io.jans.scim.service.scim2.Scim2PatchService) PostConstruct(javax.annotation.PostConstruct) QUERY_PARAM_START_INDEX(io.jans.scim.model.scim2.Constants.QUERY_PARAM_START_INDEX) QUERY_PARAM_SORT_BY(io.jans.scim.model.scim2.Constants.QUERY_PARAM_SORT_BY) GroupService(io.jans.scim.service.GroupService) PathParam(javax.ws.rs.PathParam) QUERY_PARAM_COUNT(io.jans.scim.model.scim2.Constants.QUERY_PARAM_COUNT) GET(javax.ws.rs.GET) QUERY_PARAM_ATTRIBUTES(io.jans.scim.model.scim2.Constants.QUERY_PARAM_ATTRIBUTES) DuplicateEntryException(io.jans.orm.exception.operation.DuplicateEntryException) DateUtil(io.jans.scim.model.scim2.util.DateUtil) HttpMethod(javax.ws.rs.HttpMethod) ScimResourceUtil(io.jans.scim.model.scim2.util.ScimResourceUtil) Inject(javax.inject.Inject) Named(javax.inject.Named) POST(javax.ws.rs.POST) ProtectedApi(io.jans.scim.service.filter.ProtectedApi) UTF8_CHARSET_FRAGMENT(io.jans.scim.model.scim2.Constants.UTF8_CHARSET_FRAGMENT) RefAdjusted(io.jans.scim.service.scim2.interceptor.RefAdjusted) GROUP_OVERHEAD_BYPASS_PARAM(io.jans.scim.model.scim2.Constants.GROUP_OVERHEAD_BYPASS_PARAM) InvalidAttributeValueException(javax.management.InvalidAttributeValueException) SearchRequest(io.jans.scim.model.scim2.SearchRequest) PagedResult(io.jans.orm.model.PagedResult) MEDIA_TYPE_SCIM_JSON(io.jans.scim.model.scim2.Constants.MEDIA_TYPE_SCIM_JSON) Scim2GroupService(io.jans.scim.service.scim2.Scim2GroupService) PUT(javax.ws.rs.PUT) DuplicateEntryException(io.jans.orm.exception.operation.DuplicateEntryException) GluuGroup(io.jans.scim.model.GluuGroup)

Example 13 with GluuGroup

use of io.jans.scim.model.GluuGroup in project jans by JanssenProject.

the class GroupService method addGroup.

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) {
        persistenceEntryManager.persist(group);
    } else {
        throw new DuplicateEntryException("Duplicate displayName: " + group.getDisplayName());
    }
}
Also used : DuplicateEntryException(io.jans.orm.exception.operation.DuplicateEntryException) GluuGroup(io.jans.scim.model.GluuGroup)

Example 14 with GluuGroup

use of io.jans.scim.model.GluuGroup in project jans by JanssenProject.

the class GroupService method getGroupByDisplayName.

public GluuGroup getGroupByDisplayName(String DisplayName) throws Exception {
    GluuGroup group = new GluuGroup();
    group.setBaseDn(getDnForGroup(null));
    group.setDisplayName(DisplayName);
    List<GluuGroup> groups = persistenceEntryManager.findEntries(group);
    if ((groups != null) && (groups.size() > 0)) {
        return groups.get(0);
    }
    return null;
}
Also used : GluuGroup(io.jans.scim.model.GluuGroup)

Aggregations

GluuGroup (io.jans.scim.model.GluuGroup)14 DuplicateEntryException (io.jans.orm.exception.operation.DuplicateEntryException)7 InvalidAttributeValueException (javax.management.InvalidAttributeValueException)7 SCIMException (io.jans.scim.model.exception.SCIMException)6 ProtectedApi (io.jans.scim.service.filter.ProtectedApi)6 URISyntaxException (java.net.URISyntaxException)6 DefaultValue (javax.ws.rs.DefaultValue)6 GroupResource (io.jans.scim.model.scim2.group.GroupResource)5 RefAdjusted (io.jans.scim.service.scim2.interceptor.RefAdjusted)5 URI (java.net.URI)5 HeaderParam (javax.ws.rs.HeaderParam)5 Path (javax.ws.rs.Path)5 Produces (javax.ws.rs.Produces)5 Response (javax.ws.rs.core.Response)5 PagedResult (io.jans.orm.model.PagedResult)4 BaseScimResource (io.jans.scim.model.scim2.BaseScimResource)4 DateUtil (io.jans.scim.model.scim2.util.DateUtil)4 GroupService (io.jans.scim.service.GroupService)4 ArrayList (java.util.ArrayList)4 List (java.util.List)4