mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged mward/repo-1600-zonesfilter (5.2.1) to 5.2.N (5.2.1)
134762 mward: REPO-1583: added include=parentIds support git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@134808 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -541,7 +541,14 @@ public class GroupsImpl implements Groups
|
|||||||
{
|
{
|
||||||
if (includeParam.contains(PARAM_INCLUDE_PARENT_IDS))
|
if (includeParam.contains(PARAM_INCLUDE_PARENT_IDS))
|
||||||
{
|
{
|
||||||
Set<String> containingAuthorities = authorityService.getContainingAuthorities(AuthorityType.GROUP, authorityInfo.getAuthorityName(), true);
|
String authority = authorityInfo.getAuthorityName();
|
||||||
|
Set<String> containingAuthorities = Collections.emptySet();
|
||||||
|
// Workaround for AuthorityDAO.listAuthorities, where although AuthorityType.GUEST
|
||||||
|
// 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);
|
group.setParentIds(containingAuthorities);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -39,6 +39,7 @@ import org.alfresco.rest.api.tests.client.data.Person;
|
|||||||
import org.alfresco.rest.framework.resource.parameters.SortColumn;
|
import org.alfresco.rest.framework.resource.parameters.SortColumn;
|
||||||
import org.alfresco.service.cmr.security.AuthorityService;
|
import org.alfresco.service.cmr.security.AuthorityService;
|
||||||
import org.alfresco.service.cmr.security.AuthorityType;
|
import org.alfresco.service.cmr.security.AuthorityType;
|
||||||
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
import org.alfresco.util.GUID;
|
import org.alfresco.util.GUID;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@@ -884,6 +885,37 @@ public class GroupsTest extends AbstractSingleNetworkSiteTest
|
|||||||
getGroupsByPersonId(personAlice.getId(), paging, otherParams, HttpServletResponse.SC_BAD_REQUEST);
|
getGroupsByPersonId(personAlice.getId(), paging, otherParams, HttpServletResponse.SC_BAD_REQUEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check include parent ids.
|
||||||
|
{
|
||||||
|
Paging paging = getPaging(0, Integer.MAX_VALUE);
|
||||||
|
Map<String, String> otherParams = new HashMap<>();
|
||||||
|
otherParams.put("include", org.alfresco.rest.api.Groups.PARAM_INCLUDE_PARENT_IDS);
|
||||||
|
|
||||||
|
ListResponse<Group> resp = getGroupsByPersonId(personAlice.getId(), paging, otherParams);
|
||||||
|
|
||||||
|
assertEquals(4, resp.getList().size());
|
||||||
|
|
||||||
|
Iterator<Group> it = resp.getList().iterator();
|
||||||
|
|
||||||
|
Group group = it.next();
|
||||||
|
assertEquals(PermissionService.ALL_AUTHORITIES, group.getId());
|
||||||
|
assertEquals(0, group.getParentIds().size());
|
||||||
|
|
||||||
|
group = it.next();
|
||||||
|
assertEquals(rootGroup.getId(), group.getId());
|
||||||
|
assertEquals(0, group.getParentIds().size());
|
||||||
|
|
||||||
|
group = it.next();
|
||||||
|
assertEquals(groupA.getId(), group.getId());
|
||||||
|
assertEquals(1, group.getParentIds().size());
|
||||||
|
assertTrue(group.getParentIds().contains(rootGroup.getId()));
|
||||||
|
|
||||||
|
group = it.next();
|
||||||
|
assertEquals(groupB.getId(), group.getId());
|
||||||
|
assertEquals(1, group.getParentIds().size());
|
||||||
|
assertTrue(group.getParentIds().contains(rootGroup.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
// Filter by zone, use the -me- alias.
|
// Filter by zone, use the -me- alias.
|
||||||
{
|
{
|
||||||
Map<String, String> params = new HashMap<>();
|
Map<String, String> params = new HashMap<>();
|
||||||
|
Reference in New Issue
Block a user