mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
RM-764 (In-Place roles should not appear when managing users and groups)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@52221 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -18,6 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.module.org_alfresco_module_rm.role;
|
package org.alfresco.module.org_alfresco_module_rm.role;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
|
import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
|
||||||
@@ -40,6 +42,12 @@ public interface FilePlanRoleService
|
|||||||
public static final String ROLE_EXTENDED_READERS = "ExtendedReaders";
|
public static final String ROLE_EXTENDED_READERS = "ExtendedReaders";
|
||||||
public static final String ROLE_EXTENDED_WRITERS = "ExtendedWriters";
|
public static final String ROLE_EXTENDED_WRITERS = "ExtendedWriters";
|
||||||
|
|
||||||
|
/** System roles */
|
||||||
|
public static final List<String> SYSTEM_ROLES = Arrays.asList(
|
||||||
|
ROLE_EXTENDED_READERS,
|
||||||
|
ROLE_EXTENDED_WRITERS
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of the container group for all roles of a specified file
|
* Returns the name of the container group for all roles of a specified file
|
||||||
* plan.
|
* plan.
|
||||||
@@ -51,7 +59,7 @@ public interface FilePlanRoleService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all the available roles for the given records management root node
|
* Get all the available roles for the given records management root node
|
||||||
* includes also the system roles
|
* (includes also the system roles)
|
||||||
*
|
*
|
||||||
* @param filePlan file plan
|
* @param filePlan file plan
|
||||||
* @return
|
* @return
|
||||||
@@ -59,7 +67,7 @@ public interface FilePlanRoleService
|
|||||||
Set<Role> getRoles(NodeRef filePlan);
|
Set<Role> getRoles(NodeRef filePlan);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all the available roles for the given records management root node
|
* Get all the available roles for the given records management root node.
|
||||||
* System roles can be filtered
|
* System roles can be filtered
|
||||||
*
|
*
|
||||||
* @param filePlan file plan
|
* @param filePlan file plan
|
||||||
@@ -70,8 +78,8 @@ public interface FilePlanRoleService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the roles for a given user
|
* Gets the roles for a given user
|
||||||
* includes also the system roles
|
* (includes also the system roles)
|
||||||
*
|
*
|
||||||
* @param filePlan file plan
|
* @param filePlan file plan
|
||||||
* @param user user
|
* @param user user
|
||||||
* @return
|
* @return
|
||||||
@@ -79,7 +87,7 @@ public interface FilePlanRoleService
|
|||||||
Set<Role> getRolesByUser(NodeRef filePlan, String user);
|
Set<Role> getRolesByUser(NodeRef filePlan, String user);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the roles for a given user
|
* Gets the roles for a given user.
|
||||||
* System roles can be filtered
|
* System roles can be filtered
|
||||||
*
|
*
|
||||||
* @param filePlan file plan
|
* @param filePlan file plan
|
||||||
|
@@ -24,7 +24,6 @@ import java.io.InputStream;
|
|||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
@@ -37,9 +36,9 @@ import org.alfresco.module.org_alfresco_module_rm.security.ExtendedReaderDynamic
|
|||||||
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedWriterDynamicAuthority;
|
import org.alfresco.module.org_alfresco_module_rm.security.ExtendedWriterDynamicAuthority;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.security.FilePlanAuthenticationService;
|
import org.alfresco.module.org_alfresco_module_rm.security.FilePlanAuthenticationService;
|
||||||
import org.alfresco.repo.node.NodeServicePolicies;
|
import org.alfresco.repo.node.NodeServicePolicies;
|
||||||
|
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
||||||
import org.alfresco.repo.policy.JavaBehaviour;
|
import org.alfresco.repo.policy.JavaBehaviour;
|
||||||
import org.alfresco.repo.policy.PolicyComponent;
|
import org.alfresco.repo.policy.PolicyComponent;
|
||||||
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.security.authority.RMAuthority;
|
import org.alfresco.repo.security.authority.RMAuthority;
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
@@ -402,19 +401,6 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper method for retrieving the system roles
|
|
||||||
*
|
|
||||||
* @return Returns the system roles
|
|
||||||
*/
|
|
||||||
private List<String> getSystemRoles()
|
|
||||||
{
|
|
||||||
return Arrays.asList(
|
|
||||||
FilePlanRoleService.ROLE_EXTENDED_READERS,
|
|
||||||
FilePlanRoleService.ROLE_EXTENDED_WRITERS
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to check whether the current authority is a system role or not
|
* Helper method to check whether the current authority is a system role or not
|
||||||
*
|
*
|
||||||
@@ -424,9 +410,8 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService,
|
|||||||
private boolean isSystemRole(String roleAuthority)
|
private boolean isSystemRole(String roleAuthority)
|
||||||
{
|
{
|
||||||
boolean isSystemRole = false;
|
boolean isSystemRole = false;
|
||||||
List<String> systemRoles = getSystemRoles();
|
|
||||||
|
|
||||||
for (String systemRole : systemRoles)
|
for (String systemRole : SYSTEM_ROLES)
|
||||||
{
|
{
|
||||||
if (StringUtils.contains(roleAuthority, systemRole))
|
if (StringUtils.contains(roleAuthority, systemRole))
|
||||||
{
|
{
|
||||||
|
@@ -23,6 +23,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
|
import org.alfresco.module.org_alfresco_module_rm.capability.Capability;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
|
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.role.Role;
|
import org.alfresco.module.org_alfresco_module_rm.role.Role;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||||
|
|
||||||
@@ -69,6 +70,12 @@ public class FilePlanRoleServiceImplTest extends BaseRMTestCase
|
|||||||
assertTrue(roles.size() != 0);
|
assertTrue(roles.size() != 0);
|
||||||
assertTrue(roles.size() == rolesIncludingSystemRoles.size());
|
assertTrue(roles.size() == rolesIncludingSystemRoles.size());
|
||||||
|
|
||||||
|
Set<Role> rolesWithoutSystemRoles = filePlanRoleService.getRoles(filePlan, false);
|
||||||
|
assertNotNull(rolesWithoutSystemRoles);
|
||||||
|
assertTrue(rolesWithoutSystemRoles.size() != 0);
|
||||||
|
assertTrue(rolesIncludingSystemRoles.size() > rolesWithoutSystemRoles.size());
|
||||||
|
assertTrue(rolesIncludingSystemRoles.size() == rolesWithoutSystemRoles.size() + FilePlanRoleService.SYSTEM_ROLES.size());
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user