RM-598: A records manager can assign the "Manage Rules" capability to a role.

* new capability added to Admin role by default
  * 2.1 capability patch updated



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@46753 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2013-02-19 05:22:15 +00:00
parent 5df0c1e114
commit 25b15c1834
8 changed files with 64 additions and 12 deletions

View File

@@ -112,6 +112,9 @@ public class RMv21CapabilityPatch extends AbstractModuleComponent
FilePlanRoleService.ROLE_POWER_USER,
FilePlanRoleService.ROLE_RECORDS_MANAGER,
FilePlanRoleService.ROLE_SECURITY_OFFICER);
addCapability(filePlan,
"ManageRules",
FilePlanRoleService.ROLE_ADMIN);
}
@@ -139,11 +142,23 @@ public class RMv21CapabilityPatch extends AbstractModuleComponent
for (String roleName : roles)
{
Role role = filePlanRoleService.getRole(filePlan, roleName);
if (role != null)
{
// get the roles current capabilities
Set<Capability> capabilities = role.getCapabilities();
capabilities.add(capability);
filePlanRoleService.updateRole(filePlan, role.getName(), role.getDisplayLabel(), capabilities);
// only update if the capability is missing
if (capabilities.contains(capability) == false)
{
if (logger.isDebugEnabled() == true)
{
logger.debug(" ... adding capability " + capabilityName + " to role " + role.getName());
}
capabilities.add(capability);
filePlanRoleService.updateRole(filePlan, role.getName(), role.getDisplayLabel(), capabilities);
}
}
}
}

View File

@@ -345,8 +345,11 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
String user = AuthenticationUtil.getFullyAuthenticatedUser();
authorityService.addAuthority(role.getRoleGroupName(), user);
// add the dynamic admin authority
authorityService.addAuthority(role.getRoleGroupName(), filePlanAuthenticationService.getRmAdminUserName());
if (filePlanAuthenticationService.getRmAdminUserName().equals(user) == false)
{
// add the dynamic admin authority
authorityService.addAuthority(role.getRoleGroupName(), filePlanAuthenticationService.getRmAdminUserName());
}
}
}
}