mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ALFCOM-3109 - It's impossible to change role from site manager to any other role on "Search for Site Groups" page
- Now you can chage the last group as long as there's still a user with the manager role. - Last manager check is now sums both groups and users. And added another unit test. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@15044 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1253,14 +1253,17 @@ public class SiteServiceImpl implements SiteService, SiteModel
|
||||
// Check that we are not about to remove the last site manager
|
||||
if (SiteModel.SITE_MANAGER.equals(role) == true)
|
||||
{
|
||||
Set<String> siteMangers = this.authorityService
|
||||
.getContainedAuthorities(
|
||||
AuthorityType.USER,
|
||||
getSiteRoleGroup(shortName, SITE_MANAGER, true),
|
||||
true);
|
||||
if (siteMangers.size() == 1)
|
||||
String mgrGroup = getSiteRoleGroup(shortName, SITE_MANAGER, true);
|
||||
Set<String> siteUserMangers = this.authorityService.getContainedAuthorities(AuthorityType.USER,
|
||||
mgrGroup,
|
||||
true);
|
||||
Set<String> siteGroupManagers = this.authorityService.getContainedAuthorities(AuthorityType.GROUP,
|
||||
mgrGroup,
|
||||
true);
|
||||
|
||||
if (siteUserMangers.size() + siteGroupManagers.size() == 1)
|
||||
{
|
||||
throw new SiteServiceException(MSG_DO_NOT_REMOVE_MGR, new Object[]{authorityName});
|
||||
throw new SiteServiceException(MSG_DO_NOT_CHANGE_MGR, new Object[]{authorityName});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1358,10 +1361,15 @@ public class SiteServiceImpl implements SiteService, SiteModel
|
||||
// Check that we are not about to remove the last site manager
|
||||
if (SiteModel.SITE_MANAGER.equals(currentRole) == true)
|
||||
{
|
||||
Set<String> siteMangers = this.authorityService.getContainedAuthorities(AuthorityType.USER,
|
||||
getSiteRoleGroup(shortName, SITE_MANAGER, true),
|
||||
String mgrGroup = getSiteRoleGroup(shortName, SITE_MANAGER, true);
|
||||
Set<String> siteUserMangers = this.authorityService.getContainedAuthorities(AuthorityType.USER,
|
||||
mgrGroup,
|
||||
true);
|
||||
if (siteMangers.size() == 1)
|
||||
Set<String> siteGroupManagers = this.authorityService.getContainedAuthorities(AuthorityType.GROUP,
|
||||
mgrGroup,
|
||||
true);
|
||||
|
||||
if (siteUserMangers.size() + siteGroupManagers.size() == 1)
|
||||
{
|
||||
throw new SiteServiceException(MSG_DO_NOT_CHANGE_MGR, new Object[]{authorityName});
|
||||
}
|
||||
|
Reference in New Issue
Block a user