Merged 5.2.N (5.2.2) to HEAD (5.2)

134777 rmunteanu: REPO-1884: Don't allow adding a sub-group with memberType:"PERSON"
      - Added validation and tests


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@137358 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Andrei Rebegea
2017-06-14 16:59:16 +00:00
parent c691e82867
commit 33c862b455
2 changed files with 49 additions and 8 deletions

View File

@@ -623,6 +623,12 @@ public class GroupsImpl implements Groups
throw new EntityNotFoundException("Group member with id " + groupMember.getId() + " does not exists");
}
AuthorityType existingAuthorityType = AuthorityType.getAuthorityType(groupMember.getId());
if (existingAuthorityType != authorityType)
{
throw new IllegalArgumentException("Incorrect group member type, " + existingAuthorityType + " exists with the given id");
}
authorityService.addAuthority(groupId, groupMember.getId());
String authority = authorityService.getName(authorityType, groupMember.getId());
@@ -728,7 +734,7 @@ public class GroupsImpl implements Groups
throw new EntityNotFoundException(groupId);
}
}
private void validateGroup(Group group, boolean isUpdate)
{
if (group == null)