mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged 5.2.N (5.2.2) to HEAD (5.2)
134747 cturlica: REPO-1305: Delete a group - restrict delete group to group authority git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@137354 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -1011,7 +1011,14 @@ public class GroupsTest extends AbstractSingleNetworkSiteTest
|
||||
{
|
||||
setRequestContext(networkOne.getId(), networkAdmin, DEFAULT_ADMIN_PWD);
|
||||
|
||||
groupsProxy.deleteGroup("admin", false, HttpServletResponse.SC_CONFLICT);
|
||||
groupsProxy.deleteGroup("GROUP_EVERYONE", false, HttpServletResponse.SC_CONFLICT);
|
||||
}
|
||||
|
||||
// Trying to delete a person.
|
||||
{
|
||||
setRequestContext(networkOne.getId(), networkAdmin, DEFAULT_ADMIN_PWD);
|
||||
|
||||
groupsProxy.deleteGroup(user1, false, HttpServletResponse.SC_BAD_REQUEST);
|
||||
}
|
||||
|
||||
{
|
||||
|
Reference in New Issue
Block a user