Search in sources :

Example 6 with Group

use of org.alfresco.rest.api.model.Group in project alfresco-remote-api by Alfresco.

the class GroupsImpl method getGroup.

private Group getGroup(AuthorityInfo authorityInfo, List<String> includeParam, Set<String> rootAuthorities) {
    if (authorityInfo == null) {
        return null;
    }
    Group group = new Group();
    group.setId(authorityInfo.getAuthorityName());
    // REPO-1743
    String authorityDisplayName = authorityInfo.getAuthorityDisplayName();
    if (authorityDisplayName == null || authorityDisplayName.isEmpty()) {
        authorityDisplayName = authorityService.getAuthorityDisplayName(authorityInfo.getAuthorityName());
    }
    group.setDisplayName(authorityDisplayName);
    group.setIsRoot(isRootAuthority(rootAuthorities, authorityInfo.getAuthorityName()));
    // Optionally include
    if (includeParam != null) {
        if (includeParam.contains(PARAM_INCLUDE_PARENT_IDS)) {
            String authority = authorityInfo.getAuthorityName();
            Set<String> containingAuthorities = Collections.emptySet();
            // is a special case, AuthorityType.EVERYONE is not, and an exception is thrown.
            if (!authority.equalsIgnoreCase(PermissionService.ALL_AUTHORITIES)) {
                containingAuthorities = authorityService.getContainingAuthorities(AuthorityType.GROUP, authority, true);
            }
            group.setParentIds(containingAuthorities);
        }
        if (includeParam.contains(PARAM_INCLUDE_ZONES)) {
            Set<String> authorityZones = authorityService.getAuthorityZones(authorityInfo.getAuthorityName());
            group.setZones(authorityZones);
        }
    }
    return group;
}
Also used : Group(org.alfresco.rest.api.model.Group)

Aggregations

Group (org.alfresco.rest.api.model.Group)6 EmptyPagingResults (org.alfresco.query.EmptyPagingResults)4 AuthorityInfo (org.alfresco.repo.security.authority.AuthorityInfo)4 UnknownAuthorityException (org.alfresco.repo.security.authority.UnknownAuthorityException)4 Paging (org.alfresco.rest.framework.resource.parameters.Paging)4 AuthorityType (org.alfresco.service.cmr.security.AuthorityType)4 AbstractList (java.util.AbstractList)3 Query (org.alfresco.rest.framework.resource.parameters.where.Query)3 Collator (java.text.Collator)2 ArrayList (java.util.ArrayList)2 Arrays (java.util.Arrays)2 Collections (java.util.Collections)2 Comparator (java.util.Comparator)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 List (java.util.List)2 Map (java.util.Map)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2 CannedQueryPageDetails (org.alfresco.query.CannedQueryPageDetails)2