This service provides methods for managing Roles and Policies.
                    
    
    
    
        Methods
            
    Adds a new policy to the RoleDraft.
    
    Parameters
    
    Return values
    RoleDraft
                                                    
    
        Tags
        
    
    
                                                - 
                    Throws
                
 
                - 
                                                                UnauthorizedException
                                                                                         
        
if the authenticated user is not allowed to add  a policy
    
                                     
                            - 
                    Throws
                
 
                - 
                                                                InvalidArgumentException
                                                                                         
        
if limitation of the same type is repeated in policy create
struct or if limitation is not allowed on module/function
    
                                     
                            - 
                    Throws
                
 
                - 
                                                                LimitationValidationException
                                                                                         
        
if a limitation in the $policyCreateStruct is not valid
    
                                     
                                                                                    
            
    Assigns a role to the given user.
    
    Parameters
    
        
            
                | Name | 
                Type | 
                Default value | 
                Description | 
            
        
        
                            
                    | 
                        $role
                     | 
                    
                        Role
                     | 
                    
                                                    -
                                             | 
                    
                                                    -
                                             | 
                
                            
                    | 
                        $user
                     | 
                    
                        User
                     | 
                    
                                                    -
                                             | 
                    
                                                    -
                                             | 
                
                            
                    | 
                        $roleLimitation
                     | 
                    
                        RoleLimitation|null
                     | 
                    
                                                                                    null
                                                                         | 
                    
                                                        
         an optional role limitation (which is either a subtree limitation or section limitation) 
    
                                             | 
                
                    
    
                                                
    
        Tags
        
    
    
                                                - 
                    Throws
                
 
                - 
                                                                UnauthorizedException
                                                                                         
        
if the authenticated user is not allowed to assign a role
    
                                     
                            - 
                    Throws
                
 
                - 
                                                                LimitationValidationException
                                                                                         
        
if $roleLimitation is not valid
    
                                     
                            - 
                    Throws
                
 
                - 
                                                                InvalidArgumentException
                                                                                         
        
If assignment already exists
    
                                     
                                                                                    
            
    Assigns a role to the given user group.
    
    Parameters
    
        
            
                | Name | 
                Type | 
                Default value | 
                Description | 
            
        
        
                            
                    | 
                        $role
                     | 
                    
                        Role
                     | 
                    
                                                    -
                                             | 
                    
                                                    -
                                             | 
                
                            
                    | 
                        $userGroup
                     | 
                    
                        UserGroup
                     | 
                    
                                                    -
                                             | 
                    
                                                    -
                                             | 
                
                            
                    | 
                        $roleLimitation
                     | 
                    
                        RoleLimitation|null
                     | 
                    
                                                                                    null
                                                                         | 
                    
                                                        
         an optional role limitation (which is either a subtree limitation or section limitation) 
    
                                             | 
                
                    
    
                                                
    
        Tags
        
    
    
                                                - 
                    Throws
                
 
                - 
                                                                UnauthorizedException
                                                                                         
        
if the authenticated user is not allowed to assign a role
    
                                     
                            - 
                    Throws
                
 
                - 
                                                                LimitationValidationException
                                                                                         
        
if $roleLimitation is not valid
    
                                     
                            - 
                    Throws
                
 
                - 
                                                                InvalidArgumentException
                                                                                         
        
If assignment already exists
    
                                     
                                                                                    
            
    Copies an existing Role.
    
    Parameters
    
    Return values
    Role
                                                    
    
        Tags
        
    
    
                                                - 
                    Throws
                
 
                - 
                                                                UnauthorizedException
                                                                                         
        
if the authenticated user is not allowed to copy a role
    
                                     
                            - 
                    Throws
                
 
                - 
                                                                InvalidArgumentException
                                                                                         
        
if the name of the role already exists or if limitation of the same type
is repeated in the policy create struct or if limitation is not allowed on module/function
    
                                     
                            - 
                    Throws
                
 
                - 
                                                                LimitationValidationException
                                                                                         
        
if a policy limitation in the $roleCopyStruct is not valid
    
                                     
                            - 
                    Throws
                
 
                - 
                                                                BadStateException
                                                                                         
        
if CopyRoleEvent does not posses valid Role object
    
                                     
                            - 
                    Throws
                
 
                - 
                                                                NotFoundException
                                                                                         
        
if newly cloned Role does not exist
    
                                     
                                                                                    
            
    Returns the number of users and user groups assigned to this role.
    
        
            
                | 
                    
                 | 
                
                    
                        public countRoleAssignments(Role $role) : int 
                     
                 | 
            
        
    
 
    
    Parameters
    
        
            
                | Name | 
                Type | 
                Default value | 
                Description | 
            
        
        
                            
                    | 
                        $role
                     | 
                    
                        Role
                     | 
                    
                                                    -
                                             | 
                    
                                                    -
                                             | 
                
                    
    
    Return values
    int
                                                    
    
        Tags
        
    
    
                                                - 
                    Throws
                
 
                - 
                                                                BadStateException
                                                                                     
                                    
 
                            - 
                    Throws
                
 
                - 
                                                                InvalidArgumentException
                                                                                     
                                    
 
                            - 
                    Throws
                
 
                - 
                                                                UnauthorizedException
                                                                                         
        
if the authenticated user is not allowed to read a role
    
                                     
                                                                                    
            
    Creates a new RoleDraft.
    
    Parameters
    
    Return values
    RoleDraft
                                                    
    
        Tags
        
    
    
                                                - 
                    Throws
                
 
                - 
                                                                UnauthorizedException
                                                                                         
        
if the authenticated user is not allowed to create a role
    
                                     
                            - 
                    Throws
                
 
                - 
                                                                InvalidArgumentException
                                                                                         
        
if the name of the role already exists or if limitation of the same type
is repeated in the policy create struct or if limitation is not allowed on module/function
    
                                     
                            - 
                    Throws
                
 
                - 
                                                                LimitationValidationException
                                                                                         
        
if a policy limitation in the $roleCreateStruct is not valid
    
                                     
                                                                                    
            
    Creates a new RoleDraft for existing Role.
    
    Parameters
    
        
            
                | Name | 
                Type | 
                Default value | 
                Description | 
            
        
        
                            
                    | 
                        $role
                     | 
                    
                        Role
                     | 
                    
                                                    -
                                             | 
                    
                                                    -
                                             | 
                
                    
    
    Return values
    RoleDraft
                                                    
    
        Tags
        
    
    
                                                - 
                    Throws
                
 
                - 
                                                                UnauthorizedException
                                                                                         
        
if the authenticated user is not allowed to create a role
    
                                     
                            - 
                    Throws
                
 
                - 
                                                                InvalidArgumentException
                                                                                         
        
if the Role already has a Role Draft that will need to be removed first
    
                                     
                            - 
                    Throws
                
 
                - 
                                                                LimitationValidationException
                                                                                         
        
if a policy limitation in the $roleCreateStruct is not valid
    
                                     
                                                                                    
            
    Deletes the given role.
    
        
            
                | 
                    
                 | 
                
                    
                        public deleteRole(Role $role) : void 
                     
                 | 
            
        
    
 
    
    Parameters
    
        
            
                | Name | 
                Type | 
                Default value | 
                Description | 
            
        
        
                            
                    | 
                        $role
                     | 
                    
                        Role
                     | 
                    
                                                    -
                                             | 
                    
                                                    -
                                             | 
                
                    
    
                                                
    
        Tags
        
    
    
                                                - 
                    Throws
                
 
                - 
                                                                UnauthorizedException
                                                                                         
        
if the authenticated user is not allowed to delete this role
    
                                     
                                                                                    
            
    Deletes the given RoleDraft.
    
        
            
                | 
                    
                 | 
                
                    
                        public deleteRoleDraft(RoleDraft $roleDraft) : void 
                     
                 | 
            
        
    
 
    
    Parameters
    
        
            
                | Name | 
                Type | 
                Default value | 
                Description | 
            
        
        
                            
                    | 
                        $roleDraft
                     | 
                    
                        RoleDraft
                     | 
                    
                                                    -
                                             | 
                    
                                                    -
                                             | 
                
                    
    
                                                
    
        Tags
        
    
    
                                                - 
                    Throws
                
 
                - 
                                                                UnauthorizedException
                                                                                         
        
if the authenticated user is not allowed to delete this RoleDraft
    
                                     
                                                                                    
            
    Returns the LimitationType registered with the given identifier.
    
        
            
                | 
                    
                 | 
                
                    
                        public getLimitationType(string $identifier) : Type 
                     
                 | 
            
        
    
 
    
    Parameters
    
        
            
                | Name | 
                Type | 
                Default value | 
                Description | 
            
        
        
                            
                    | 
                        $identifier
                     | 
                    
                        string
                     | 
                    
                                                    -
                                             | 
                    
                                                    -
                                             | 
                
                    
    
    Return values
    Type
                                                    
    
        Tags
        
    
    
                                                - 
                    Throws
                
 
                - 
                                                                RuntimeException
                                                                                         
                                    
 
                                                                                    
            
    Returns the LimitationType's assigned to a given module/function.
    
        
            
                | 
                    
                 | 
                
                    
                        public getLimitationTypesByModuleFunction(string $module, string $function) : array<string|int, Type> 
                     
                 | 
            
        
    
 
    
    
        Typically used for:
- Internal validation limitation value use on Policies
 
- Role admin gui for editing policy limitations incl list limitation options via valueSchema()
 
    
    Parameters
    
        
            
                | Name | 
                Type | 
                Default value | 
                Description | 
            
        
        
                            
                    | 
                        $module
                     | 
                    
                        string
                     | 
                    
                                                    -
                                             | 
                    
                                                        
         Legacy name of "controller", it's a unique identifier like "content" 
    
                                             | 
                
                            
                    | 
                        $function
                     | 
                    
                        string
                     | 
                    
                                                    -
                                             | 
                    
                                                        
         Legacy name of a controller "action", it's a unique within the controller like "read" 
    
                                             | 
                
                    
    
    Return values
    array<string|int, Type>
                                                    
    
        Tags
        
    
    
                                                - 
                    Throws
                
 
                - 
                                                                BadStateException
                                                                                         
        
If module/function to limitation type mapping
refers to a non existing identifier.
    
                                     
                                                                                    
            
    Returns the assigned user and user groups to this role.
    
    Parameters
    
        
            
                | Name | 
                Type | 
                Default value | 
                Description | 
            
        
        
                            
                    | 
                        $role
                     | 
                    
                        Role
                     | 
                    
                                                    -
                                             | 
                    
                                                    -
                                             | 
                
                    
    
    Return values
    array<string|int, RoleAssignment>
                                                    
    
        Tags
        
    
    
                                                - 
                    Throws
                
 
                - 
                                                                UnauthorizedException
                                                                                         
        
if the authenticated user is not allowed to read a role
    
                                     
                                                                                    
            
    Returns UserRoleAssignments assigned to the given User, excluding the ones the current user is not allowed to read.
    
    
        If second parameter $inherited is true then UserGroupRoleAssignment is also returned for UserGroups User is
placed in as well as those inherited from parent UserGroups.
    
    Parameters
    
        
            
                | Name | 
                Type | 
                Default value | 
                Description | 
            
        
        
                            
                    | 
                        $user
                     | 
                    
                        User
                     | 
                    
                                                    -
                                             | 
                    
                                                    -
                                             | 
                
                            
                    | 
                        $inherited
                     | 
                    
                        bool
                     | 
                    
                                                                                    false
                                                                         | 
                    
                                                        
         Also return all inherited Roles from UserGroups User belongs to, and it's parents. 
    
                                             | 
                
                    
    
    Return values
    array<string|int, UserRoleAssignment>|array<string|int, UserGroupRoleAssignment>
                                                    
    
        Tags
        
    
    
                                                - 
                    Throws
                
 
                - 
                                                                InvalidArgumentException
                                                                                         
                                    
 
                                                                                    
            
    Returns the UserGroupRoleAssignments assigned to the given UserGroup, excluding the ones the current user is not allowed to read.
    
    Parameters
    
        
            
                | Name | 
                Type | 
                Default value | 
                Description | 
            
        
        
                            
                    | 
                        $userGroup
                     | 
                    
                        UserGroup
                     | 
                    
                                                    -
                                             | 
                    
                                                    -
                                             | 
                
                    
    
    Return values
    array<string|int, UserGroupRoleAssignment>
                        
            
    Loads a role for the given id.
    
        
            
                | 
                    
                 | 
                
                    
                        public loadRole(int $id) : Role 
                     
                 | 
            
        
    
 
    
    Parameters
    
        
            
                | Name | 
                Type | 
                Default value | 
                Description | 
            
        
        
                            
                    | 
                        $id
                     | 
                    
                        int
                     | 
                    
                                                    -
                                             | 
                    
                                                    -
                                             | 
                
                    
    
    Return values
    Role
                                                    
    
        Tags
        
    
    
                                                - 
                    Throws
                
 
                - 
                                                                UnauthorizedException
                                                                                         
        
if the authenticated user is not allowed to read this role
    
                                     
                            - 
                    Throws
                
 
                - 
                                                                NotFoundException
                                                                                         
        
if a role with the given name was not found
    
                                     
                                                                                    
            
    Loads a role assignment for the given id.
    
    Parameters
    
        
            
                | Name | 
                Type | 
                Default value | 
                Description | 
            
        
        
                            
                    | 
                        $roleAssignmentId
                     | 
                    
                        int
                     | 
                    
                                                    -
                                             | 
                    
                                                    -
                                             | 
                
                    
    
    Return values
    RoleAssignment
                                                    
    
        Tags
        
    
    
                                                - 
                    Throws
                
 
                - 
                                                                UnauthorizedException
                                                                                         
        
if the authenticated user is not allowed to read this role
    
                                     
                            - 
                    Throws
                
 
                - 
                                                                NotFoundException
                                                                                         
        
If the role assignment was not found
    
                                     
                                                                                    
            
    Returns the assigned users and user groups to this role with $offset and $limit arguments.
    
        
            
                | 
                    
                 | 
                
                    
                        public loadRoleAssignments(Role $role[, int $offset = 0 ][, int|null $limit = null ]) : array<string|int, RoleAssignment> 
                     
                 | 
            
        
    
 
    
    Parameters
    
        
            
                | Name | 
                Type | 
                Default value | 
                Description | 
            
        
        
                            
                    | 
                        $role
                     | 
                    
                        Role
                     | 
                    
                                                    -
                                             | 
                    
                                                    -
                                             | 
                
                            
                    | 
                        $offset
                     | 
                    
                        int
                     | 
                    
                                                                                    0
                                                                         | 
                    
                                                    -
                                             | 
                
                            
                    | 
                        $limit
                     | 
                    
                        int|null
                     | 
                    
                                                                                    null
                                                                         | 
                    
                                                    -
                                             | 
                
                    
    
    Return values
    array<string|int, RoleAssignment>
                                                    
    
        Tags
        
    
    
                                                - 
                    Throws
                
 
                - 
                                                                BadStateException
                                                                                     
                                    
 
                            - 
                    Throws
                
 
                - 
                                                                InvalidArgumentException
                                                                                     
                                    
 
                            - 
                    Throws
                
 
                - 
                                                                UnauthorizedException
                                                                                         
        
if the authenticated user is not allowed to read a role
    
                                     
                                                                                    
            
    Loads a role for the given identifier.
    
        
            
                | 
                    
                 | 
                
                    
                        public loadRoleByIdentifier(string $identifier) : Role 
                     
                 | 
            
        
    
 
    
    Parameters
    
        
            
                | Name | 
                Type | 
                Default value | 
                Description | 
            
        
        
                            
                    | 
                        $identifier
                     | 
                    
                        string
                     | 
                    
                                                    -
                                             | 
                    
                                                    -
                                             | 
                
                    
    
    Return values
    Role
                                                    
    
        Tags
        
    
    
                                                - 
                    Throws
                
 
                - 
                                                                UnauthorizedException
                                                                                         
        
if the authenticated user is not allowed to read this role
    
                                     
                            - 
                    Throws
                
 
                - 
                                                                NotFoundException
                                                                                         
        
if a role with the given name was not found
    
                                     
                                                                                    
            
    Loads a RoleDraft for the given id.
    
    Parameters
    
        
            
                | Name | 
                Type | 
                Default value | 
                Description | 
            
        
        
                            
                    | 
                        $id
                     | 
                    
                        int
                     | 
                    
                                                    -
                                             | 
                    
                                                    -
                                             | 
                
                    
    
    Return values
    RoleDraft
                                                    
    
        Tags
        
    
    
                                                - 
                    Throws
                
 
                - 
                                                                UnauthorizedException
                                                                                         
        
if the authenticated user is not allowed to read this role
    
                                     
                            - 
                    Throws
                
 
                - 
                                                                NotFoundException
                                                                                         
        
if a RoleDraft with the given id was not found
    
                                     
                                                                                    
            
    Loads a RoleDraft by the ID of the role it was created from.
    
        
            
                | 
                    
                 | 
                
                    
                        public loadRoleDraftByRoleId(int $roleId) : RoleDraft 
                     
                 | 
            
        
    
 
    
    Parameters
    
        
            
                | Name | 
                Type | 
                Default value | 
                Description | 
            
        
        
                            
                    | 
                        $roleId
                     | 
                    
                        int
                     | 
                    
                                                    -
                                             | 
                    
                                                        
         ID of the role the draft was created from. 
    
                                             | 
                
                    
    
    Return values
    RoleDraft
                                                    
    
        Tags
        
    
    
                                                - 
                    Throws
                
 
                - 
                                                                UnauthorizedException
                                                                                         
        
if the authenticated user is not allowed to read this role
    
                                     
                            - 
                    Throws
                
 
                - 
                                                                NotFoundException
                                                                                         
        
if a RoleDraft with the given id was not found
    
                                     
                                                                                    
            
    Loads all roles, excluding the ones the current user is not allowed to read.
    
        
            
                | 
                    
                 | 
                
                    
                        public loadRoles() : array<string|int, Role> 
                     
                 | 
            
        
    
 
    
    Return values
    array<string|int, Role>
                        
            
    Instantiates a policy create class.
    
    Parameters
    
        
            
                | Name | 
                Type | 
                Default value | 
                Description | 
            
        
        
                            
                    | 
                        $module
                     | 
                    
                        string
                     | 
                    
                                                    -
                                             | 
                    
                                                    -
                                             | 
                
                            
                    | 
                        $function
                     | 
                    
                        string
                     | 
                    
                                                    -
                                             | 
                    
                                                    -
                                             | 
                
                    
    
    Return values
    PolicyCreateStruct
                        
            
    Instantiates a policy update class.
    
    Return values
    PolicyUpdateStruct
                        
            
    Instantiates a role copy struct.
    
    Parameters
    
        
            
                | Name | 
                Type | 
                Default value | 
                Description | 
            
        
        
                            
                    | 
                        $name
                     | 
                    
                        string
                     | 
                    
                                                    -
                                             | 
                    
                                                    -
                                             | 
                
                    
    
    Return values
    RoleCopyStruct
                        
            
    Instantiates a role create class.
    
    Parameters
    
        
            
                | Name | 
                Type | 
                Default value | 
                Description | 
            
        
        
                            
                    | 
                        $name
                     | 
                    
                        string
                     | 
                    
                                                    -
                                             | 
                    
                                                    -
                                             | 
                
                    
    
    Return values
    RoleCreateStruct
                        
            
    Instantiates a policy update class.
    
    Return values
    RoleUpdateStruct
                        
            
    Publishes the given RoleDraft.
    
        
            
                | 
                    
                 | 
                
                    
                        public publishRoleDraft(RoleDraft $roleDraft) : void 
                     
                 | 
            
        
    
 
    
    Parameters
    
        
            
                | Name | 
                Type | 
                Default value | 
                Description | 
            
        
        
                            
                    | 
                        $roleDraft
                     | 
                    
                        RoleDraft
                     | 
                    
                                                    -
                                             | 
                    
                                                    -
                                             | 
                
                    
    
                                                
    
        Tags
        
    
    
                                                - 
                    Throws
                
 
                - 
                                                                UnauthorizedException
                                                                                         
        
if the authenticated user is not allowed to publish this RoleDraft
    
                                     
                                                                                    
            
    Removes a policy from a RoleDraft.
    
    Parameters
    
        
            
                | Name | 
                Type | 
                Default value | 
                Description | 
            
        
        
                            
                    | 
                        $roleDraft
                     | 
                    
                        RoleDraft
                     | 
                    
                                                    -
                                             | 
                    
                                                    -
                                             | 
                
                            
                    | 
                        $policyDraft
                     | 
                    
                        PolicyDraft
                     | 
                    
                                                    -
                                             | 
                    
                                                        
         the policy to remove from the RoleDraft 
    
                                             | 
                
                    
    
    Return values
    RoleDraft
                                                    
    
        Tags
        
    
    
                                                - 
                    Throws
                
 
                - 
                                                                UnauthorizedException
                                                                                         
        
if the authenticated user is not allowed to remove a policy
    
                                     
                            - 
                    Throws
                
 
                - 
                                                                InvalidArgumentException
                                                                                         
        
if policy does not belong to the given RoleDraft
    
                                     
                                                                                    
            
    Removes the given role assignment.
    
    
        i.e. unassigns a user or a user group from a role with the given limitations
    
    Parameters
    
        
            
                | Name | 
                Type | 
                Default value | 
                Description | 
            
        
        
                            
                    | 
                        $roleAssignment
                     | 
                    
                        RoleAssignment
                     | 
                    
                                                    -
                                             | 
                    
                                                    -
                                             | 
                
                    
    
                                                
    
        Tags
        
    
    
                                                - 
                    Throws
                
 
                - 
                                                                UnauthorizedException
                                                                                         
        
if the authenticated user is not allowed to remove a role assignment
    
                                     
                                                                                    
            
    Updates the limitations of a policy. The module and function cannot be changed and
the limitations are replaced by the ones in $roleUpdateStruct.
    
    Parameters
    
    Return values
    PolicyDraft
                                                    
    
        Tags
        
    
    
                                                - 
                    Throws
                
 
                - 
                                                                UnauthorizedException
                                                                                         
        
if the authenticated user is not allowed to update a policy
    
                                     
                            - 
                    Throws
                
 
                - 
                                                                InvalidArgumentException
                                                                                         
        
if limitation of the same type is repeated in policy update
struct or if limitation is not allowed on module/function
    
                                     
                            - 
                    Throws
                
 
                - 
                                                                LimitationValidationException
                                                                                         
        
if a limitation in the $policyUpdateStruct is not valid
    
                                     
                                                                                    
            
    Updates the properties of a RoleDraft.
    
    Parameters
    
    Return values
    RoleDraft
                                                    
    
        Tags
        
    
    
                                                - 
                    Throws
                
 
                - 
                                                                UnauthorizedException
                                                                                         
        
if the authenticated user is not allowed to update a role
    
                                     
                            - 
                    Throws
                
 
                - 
                                                                InvalidArgumentException
                                                                                         
        
if the identifier of the RoleDraft already exists