REPO-1305: Delete a group

- restrict delete group to group authority

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@134747 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Cristian Turlica
2017-01-25 08:56:11 +00:00
parent cc0b2e2157
commit 5f20a39cee
2 changed files with 19 additions and 1 deletions

View File

@@ -528,6 +528,11 @@ public class GroupsImpl implements Groups
public void delete(String groupId, Parameters parameters)
{
if (!isGroupAuthority(groupId))
{
throw new InvalidArgumentException("Invalid group id: " + groupId);
}
// Get cascade param - default false (if not provided).
boolean cascade = Boolean.valueOf(parameters.getParameter(PARAM_CASCADE));
@@ -741,4 +746,10 @@ public class GroupsImpl implements Groups
return (name != null && authorityService.authorityExists(name));
}
private boolean isGroupAuthority(String authorityName)
{
AuthorityType authorityType = AuthorityType.getAuthorityType(authorityName);
return AuthorityType.GROUP.equals(authorityType) || AuthorityType.EVERYONE.equals(authorityType);
}
}