Interface AuthorizationService


  • public interface AuthorizationService
    Provides services related to users and permissions.
    Since:
    1.0.1
    Version:
    $Id$
    Author:
    Colin DuPlantis
    • Method Detail

      • save

        Permission save​(Permission inPermission)
        Saves the given Permission.
        Parameters:
        inPermission - a Permission value
        Returns:
        a Permission value
      • findPermissionByName

        Permission findPermissionByName​(String inName)
        Finds the Permission with the given name.
        Parameters:
        inName - a String value
        Returns:
        a Permission value or null
      • findRoleByName

        Role findRoleByName​(String inName)
        Finds the Role with the given name.
        Parameters:
        inName - a String value
        Returns:
        a Role value or null
      • save

        Role save​(Role inRole)
        Saves the given Role.
        Parameters:
        inRole - a Role value
        Returns:
        a Role value
      • findAllRoles

        List<Role> findAllRoles()
        Find all Role values.
        Returns:
        a List<Role> value
      • findAllRoles

        CollectionPageResponse<Role> findAllRoles​(PageRequest inPageRequest)
        Find a page of Role values.
        Parameters:
        inPageRequest - a PageRequest value
        Returns:
        a CollectionPageResponse<Role> value
      • deleteRole

        void deleteRole​(String inRoleName)
        Delete the role with the given name.
        Parameters:
        inRoleName - a String value
      • authorize

        void authorize​(String inUsername,
                       String inPermissionName)
        Validate that the user with the given username has been granted the permission with the given permission name.
        Parameters:
        inUsername - a String value
        inPermissionName - a String value
        Throws:
        IllegalArgumentException - if the user or permission name is invalid
        NotAuthorizedException - if the user and permission are valid but the user has not been granted the permission
      • authorizeNoException

        boolean authorizeNoException​(String inUsername,
                                     String inPermissionName)
        Validate that the user with the given username has been granted the permission with the given permission name.

        This method will return a boolean value indicating if the permission is granted or not.

        Parameters:
        inUsername - a String value
        inPermissionName - a String value
        Returns:
        a boolean value
        Throws:
        IllegalArgumentException - if the user or permission name is invalid
      • getSupervisorsFor

        Set<User> getSupervisorsFor​(String inUsername,
                                    String inPermissionName)
        Get the users that have the given supervisor permission over the given user.
        Parameters:
        inUsername - a String value
        inPermissionName - a String value
        Returns:
        a Set<User> value
        Throws:
        IllegalArgumentException - if the user or permission name is invalid
      • findAllPermissionsByUsername

        Set<Permission> findAllPermissionsByUsername​(String inUsername)
        Finds all Permission values granted to the user with the given username.
        Parameters:
        inUsername - a String value
        Returns:
        a Set<Permissions> value
      • findAllPermissions

        List<Permission> findAllPermissions()
        Find all Permission values.
        Returns:
        a List<Permission> value
      • findAllPermissions

        CollectionPageResponse<Permission> findAllPermissions​(PageRequest inPageRequest)
        Find some Permission values.
        Parameters:
        inPageRequest - a PageRequest value
        Returns:
        a CollectionPageResponse<Permission> value
      • deletePermission

        void deletePermission​(String inPermissionName)
        Delete the Permission with the given name.
        Parameters:
        inPermissionName - a String value
      • findSupervisorPermissionByName

        SupervisorPermission findSupervisorPermissionByName​(String inName)
        Find the given supervisor permission by name.
        Parameters:
        inName - a String value
        Returns:
        a SupervisorPermission or null
      • save

        SupervisorPermission save​(SupervisorPermission inSupervisorPermission)
        Save the given supervisor permission value.
        Parameters:
        inSupervisorPermission - a SupervisorPermission value
        Returns:
        a SupervisorPermission value
      • getSubjectUsersFor

        Set<User> getSubjectUsersFor​(User inSupervisorUser,
                                     String inPermissionName)
        Get the users over which the given user has the given permission.
        Parameters:
        inSupervisorUser - a User value
        inPermissionName - a String value
        Returns:
        a Set<User> value