mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
REPO-1800: Create group with an id that contains "/" does not return an error
- added validation git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@134748 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -701,6 +701,11 @@ public class GroupsImpl implements Groups
|
|||||||
throw new InvalidArgumentException("groupId is null or empty");
|
throw new InvalidArgumentException("groupId is null or empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (group.getId().indexOf('/') != -1)
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException("groupId contains characters that are not permitted.");
|
||||||
|
}
|
||||||
|
|
||||||
if (groupAuthorityExists(group.getId()))
|
if (groupAuthorityExists(group.getId()))
|
||||||
{
|
{
|
||||||
throw new ConstraintViolatedException("Group '" + group.getId() + "' already exists.");
|
throw new ConstraintViolatedException("Group '" + group.getId() + "' already exists.");
|
||||||
|
@@ -881,6 +881,15 @@ public class GroupsTest extends AbstractSingleNetworkSiteTest
|
|||||||
groupsProxy.createGroup(group, null, HttpServletResponse.SC_BAD_REQUEST);
|
groupsProxy.createGroup(group, null, HttpServletResponse.SC_BAD_REQUEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create group with an id that contains "/" should return an error.
|
||||||
|
{
|
||||||
|
setRequestContext(networkOne.getId(), networkAdmin, DEFAULT_ADMIN_PWD);
|
||||||
|
|
||||||
|
Group group = new Group();
|
||||||
|
group.setId("/test/");
|
||||||
|
groupsProxy.createGroup(group, null, HttpServletResponse.SC_BAD_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
// Id clashes with an existing group.
|
// Id clashes with an existing group.
|
||||||
{
|
{
|
||||||
setRequestContext(networkOne.getId(), networkAdmin, DEFAULT_ADMIN_PWD);
|
setRequestContext(networkOne.getId(), networkAdmin, DEFAULT_ADMIN_PWD);
|
||||||
|
Reference in New Issue
Block a user