Class RoleService


  • @Service
    public class RoleService
    extends Object
    Produces processed results from roles API calls
    Since:
    2.6
    Author:
    Rodica Sutu
    • Constructor Detail

      • RoleService

        public RoleService()
    • Method Detail

      • getRoleCapabilities

        public Set<String> getRoleCapabilities​(String roleName)
        Get the capabilities for a role
        Parameters:
        roleName - the role name
        Returns:
        the list of capabilities
      • addCapabilitiesToRole

        public void addCapabilitiesToRole​(UserRoles role,
                                          Set<String> capabilities)
        Add capabilities to a role
        Parameters:
        role - role to be updated
        capabilities - list of capabilities to be added
      • removeCapabilitiesFromRole

        public void removeCapabilitiesFromRole​(UserRoles role,
                                               Set<String> capabilities)
        Remove capabilities from a role
        Parameters:
        role - role to be updated
        capabilities - list of capabilities to be removed
      • assignUserPermissionsOnCategoryAndRMRole

        public void assignUserPermissionsOnCategoryAndRMRole​(org.alfresco.utility.model.UserModel user,
                                                             String categoryId,
                                                             UserPermissions userPermission,
                                                             String userRole)
        Assign permission on a record category and give the user RM role
        Parameters:
        user - the user to assign rm role and permissions
        categoryId - the id of the category to assign permissions for
        userPermission - the permissions to be assigned to the user
        userRole - the rm role to be assigned to the user
      • createUserWithRMRole

        public org.alfresco.utility.model.UserModel createUserWithRMRole​(String userRole)
        Helper method to create a test user with rm role
        Parameters:
        userRole - the rm role
        Returns:
        the created user model
      • createUserWithRMRoleAndCategoryPermission

        public org.alfresco.utility.model.UserModel createUserWithRMRoleAndCategoryPermission​(String userRole,
                                                                                              RecordCategory recordCategory,
                                                                                              UserPermissions userPermission)
        Helper method to create a test user with rm role and permissions over the record category
        Parameters:
        userRole - the rm role
        userPermission - the permissions over the record category
        recordCategory - the category on which user has permissions
        Returns:
        the created user model
      • createUserWithRMRoleAndRMNodePermission

        public org.alfresco.utility.model.UserModel createUserWithRMRoleAndRMNodePermission​(String userRole,
                                                                                            String componentId,
                                                                                            UserPermissions userPermission)
        Helper method to create a user with rm role and permissions on the node ref
        Parameters:
        userRole - the rm role
        userPermission - the permissions over the rm node
        componentId - the node id to grant rm permission
        Returns:
        the created user model
      • createCollaboratorWithRMRoleAndPermission

        public org.alfresco.utility.model.UserModel createCollaboratorWithRMRoleAndPermission​(org.alfresco.utility.model.SiteModel siteModel,
                                                                                              RecordCategory recordCategory,
                                                                                              UserRoles userRole,
                                                                                              UserPermissions userPermission)
        Helper method to create a user with rm role and permissions over the recordCategory and collaborator role in collaboration site
        Parameters:
        siteModel - collaboration site
        recordCategory - the category on which permission should be given
        userRole - the rm role
        userPermission - the permissions over the recordCategory
        Returns:
        the created user model
      • createUserWithSiteRoleRMRoleAndPermission

        public org.alfresco.utility.model.UserModel createUserWithSiteRoleRMRoleAndPermission​(org.alfresco.utility.model.SiteModel siteModel,
                                                                                              org.alfresco.utility.constants.UserRole userSiteRole,
                                                                                              String rmNodeId,
                                                                                              UserRoles userRole,
                                                                                              UserPermissions userPermission)
        Helper method to create a test user with a rm role and permissions over a rm component and a role in collaboration site
        Parameters:
        siteModel - collaboration site
        userSiteRole - user role in the collaboration site
        rmNodeId - rm node id to grant rm permission
        userRole - the rm role
        userPermission - the permissions over the rmNodeId
        Returns:
        the created user model