mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.2 to HEAD
16029: ALFCOM-3293 - MT: group management broken with domain mismatch error (fallout from CHK-7357) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16036 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -410,30 +410,80 @@ public class MultiTDemoTest extends TestCase
|
||||
{
|
||||
logger.info("Create demo groups");
|
||||
|
||||
assertTrue(tenants.size() > 0);
|
||||
|
||||
final int rootGrpsOrigCnt = AuthenticationUtil.runAs(new RunAsWork<Integer>()
|
||||
{
|
||||
public Integer doWork() throws Exception
|
||||
{
|
||||
return authorityService.getAllRootAuthorities(AuthorityType.GROUP).size();
|
||||
}
|
||||
}, tenantService.getDomainUser(AuthenticationUtil.getAdminUserName(), tenants.get(0)));
|
||||
|
||||
// create groups and add users
|
||||
for (final String tenantDomain : tenants)
|
||||
{
|
||||
String tenantAdminName = tenantService.getDomainUser(AuthenticationUtil.getAdminUserName(), tenantDomain);
|
||||
final String tenantAdminName = tenantService.getDomainUser(AuthenticationUtil.getAdminUserName(), tenantDomain);
|
||||
|
||||
AuthenticationUtil.runAs(new RunAsWork<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
{
|
||||
createGroup("GrpA", null);
|
||||
createGroup("SubGrpA", "GrpA");
|
||||
|
||||
createGroup("GrpB", null);
|
||||
|
||||
createGroup("GrpC", null);
|
||||
|
||||
if (tenantDomain.equals(TEST_TENANT_DOMAIN2))
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
{
|
||||
createGroup("GrpA-"+tenantDomain, null);
|
||||
createGroup("SubGrpA-"+tenantDomain, "GrpA-"+tenantDomain);
|
||||
|
||||
createGroup("GrpB-"+tenantDomain, null);
|
||||
createGroup("SubGrpB-"+tenantDomain, "GrpB-"+tenantDomain);
|
||||
|
||||
if (tenantDomain.equals(TEST_TENANT_DOMAIN2))
|
||||
{
|
||||
createGroup("GrpC-"+tenantDomain, null);
|
||||
createGroup("SubGrpC-"+tenantDomain, "GrpC-"+tenantDomain);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}, tenantAdminName);
|
||||
createGroup("SubGrpC", "GrpC");
|
||||
}
|
||||
|
||||
createGroup("GrpD", null);
|
||||
addToGroup("GrpD", tenantAdminName);
|
||||
|
||||
return null;
|
||||
}
|
||||
}, tenantAdminName);
|
||||
}
|
||||
|
||||
// check groups/users
|
||||
for (final String tenantDomain : tenants)
|
||||
{
|
||||
final String tenantAdminName = tenantService.getDomainUser(AuthenticationUtil.getAdminUserName(), tenantDomain);
|
||||
|
||||
AuthenticationUtil.runAs(new RunAsWork<Object>()
|
||||
{
|
||||
public Object doWork() throws Exception
|
||||
{
|
||||
Set<String> rootGrps = authorityService.getAllRootAuthorities(AuthorityType.GROUP);
|
||||
assertEquals(rootGrpsOrigCnt+4, rootGrps.size());
|
||||
|
||||
Set<String> auths = authorityService.getContainedAuthorities(null, "GROUP_GrpA", true);
|
||||
assertEquals(1, auths.size());
|
||||
|
||||
auths = authorityService.getContainedAuthorities(null, "GROUP_GrpB", true);
|
||||
assertEquals(0, auths.size());
|
||||
|
||||
auths = authorityService.getContainedAuthorities(null, "GROUP_GrpC", true);
|
||||
if (tenantDomain.equals(TEST_TENANT_DOMAIN2))
|
||||
{
|
||||
assertEquals(1, auths.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
assertEquals(0, auths.size());
|
||||
}
|
||||
|
||||
auths = authorityService.getContainedAuthorities(null, "GROUP_GrpD", true);
|
||||
assertEquals(1, auths.size());
|
||||
assertTrue(auths.toArray()[0].equals(tenantAdminName));
|
||||
|
||||
return null;
|
||||
}
|
||||
}, tenantAdminName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -885,9 +935,8 @@ public class MultiTDemoTest extends TestCase
|
||||
|
||||
if (parentGroupName != null)
|
||||
{
|
||||
this.authorityService.addAuthority(parentGroupName, groupName);
|
||||
addToGroup(parentShortName, groupName);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -895,6 +944,11 @@ public class MultiTDemoTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
private void addToGroup(String parentGroupShortName, String authorityName)
|
||||
{
|
||||
String parentGroupName = this.authorityService.getName(AuthorityType.GROUP, parentGroupShortName);
|
||||
authorityService.addAuthority(parentGroupName, authorityName);
|
||||
}
|
||||
|
||||
private NodeRef createUser(String baseUserName, String tenantDomain, String password)
|
||||
{
|
||||
|
Reference in New Issue
Block a user