Interface AuthorizationPolicy

  • All Known Implementing Classes:
    DefaultAuthorizationPolicy

    public interface AuthorizationPolicy
    It holds a registry of permission collections assigned to individual Role and Group instances.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addPermission​(org.jboss.errai.security.shared.api.Group group, Permission permission)
      Add a single permission entry for a group.
      String getGroupDescription​(org.jboss.errai.security.shared.api.Group group)
      Get the description of an existing group.
      Set<org.jboss.errai.security.shared.api.Group> getGroups()
      Get the collection of groups this policy is related to.
      String getHomePerspective()
      Gets the identifier of the default home perspective.
      String getHomePerspective​(org.jboss.errai.security.shared.api.Group group)
      Get the identifier of the home perspective assigned to the given group.
      String getHomePerspective​(org.jboss.errai.security.shared.api.identity.User user)
      Get the identifier of the perspective this user is redirected by default.
      String getHomePerspective​(org.jboss.errai.security.shared.api.Role role)
      Get the identifier of the home perspective assigned to the given group.
      PermissionCollection getPermissions()
      Get the default permissions.
      PermissionCollection getPermissions​(org.jboss.errai.security.shared.api.Group group)
      Get the permissions assigned to a given group.
      PermissionCollection getPermissions​(org.jboss.errai.security.shared.api.Role role)
      Get the permissions assigned to a given role.
      int getPriority​(org.jboss.errai.security.shared.api.Group group)
      Get a group's priority.
      int getPriority​(org.jboss.errai.security.shared.api.Role role)
      Get a role's priority.
      String getRoleDescription​(org.jboss.errai.security.shared.api.Role role)
      Get the description of an existing role.
      Set<org.jboss.errai.security.shared.api.Role> getRoles()
      Get the collection of roles this policy is related to.
      void setGroupDescription​(org.jboss.errai.security.shared.api.Group group, String description)
      Sets a description for an existing group.
      void setHomePerspective​(String perspectiveId)
      Sets the identifier of the default home perspective.
      void setHomePerspective​(org.jboss.errai.security.shared.api.Group group, String perspectiveId)
      Set the identifier of the home perspective assigned to the given group.
      void setHomePerspective​(org.jboss.errai.security.shared.api.Role role, String perspectiveId)
      Set the identifier of the home perspective assigned to the given role.
      void setPermissions​(org.jboss.errai.security.shared.api.Group group, PermissionCollection permissions)
      Set the group's permissions
      void setPermissions​(org.jboss.errai.security.shared.api.Role role, PermissionCollection permissions)
      Set the role's permissions
      void setPriority​(org.jboss.errai.security.shared.api.Group group, int priority)
      Set the group's priority
      void setPriority​(org.jboss.errai.security.shared.api.Role role, int priority)
      Set the role's priority
      void setRoleDescription​(org.jboss.errai.security.shared.api.Role role, String description)
      Sets a description for an existing role.
    • Method Detail

      • getRoles

        Set<org.jboss.errai.security.shared.api.Role> getRoles()
        Get the collection of roles this policy is related to.
      • getGroups

        Set<org.jboss.errai.security.shared.api.Group> getGroups()
        Get the collection of groups this policy is related to.
      • getRoleDescription

        String getRoleDescription​(org.jboss.errai.security.shared.api.Role role)
        Get the description of an existing role.
        Parameters:
        role - The role
        Returns:
        The role description
      • setRoleDescription

        void setRoleDescription​(org.jboss.errai.security.shared.api.Role role,
                                String description)
        Sets a description for an existing role.
        Parameters:
        role - The role
        description - A non empty description
      • getGroupDescription

        String getGroupDescription​(org.jboss.errai.security.shared.api.Group group)
        Get the description of an existing group.
        Parameters:
        group - The group
        Returns:
        The group description
      • setGroupDescription

        void setGroupDescription​(org.jboss.errai.security.shared.api.Group group,
                                 String description)
        Sets a description for an existing group.
        Parameters:
        group - The group identifier
        description - A non empty description
      • getPriority

        int getPriority​(org.jboss.errai.security.shared.api.Role role)
        Get a role's priority. The priority is important during permission resolution and when a user is assigned to more than one role/group it is used to determine what is the most priority.
        Parameters:
        role - The role instance
        Returns:
        An integer. The highest, the more priority the collection is. Default priority value is 0.
      • getPriority

        int getPriority​(org.jboss.errai.security.shared.api.Group group)
        Get a group's priority. The priority is important during permission resolution and when a user is assigned to more than one role/group it is used to determine what is the most priority.
        Parameters:
        group - The group instance
        Returns:
        An integer. The highest, the more priority the collection is. Default priority value is 0.
      • setPriority

        void setPriority​(org.jboss.errai.security.shared.api.Role role,
                         int priority)
        Set the role's priority
        Parameters:
        role - The role instance
        priority - Any valid integer. The highest, the more priority the role is.
      • setPriority

        void setPriority​(org.jboss.errai.security.shared.api.Group group,
                         int priority)
        Set the group's priority
        Parameters:
        group - The group instance
        priority - Any valid integer. The highest, the more priority the role is.
      • getPermissions

        PermissionCollection getPermissions​(org.jboss.errai.security.shared.api.Role role)
        Get the permissions assigned to a given role.
        Parameters:
        role - The role instance
        Returns:
        The permission collection. Notice, the default permission collection is also included in the results.
      • setPermissions

        void setPermissions​(org.jboss.errai.security.shared.api.Role role,
                            PermissionCollection permissions)
        Set the role's permissions
        Parameters:
        role - The role instance
        permissions - A permission collection
      • getPermissions

        PermissionCollection getPermissions​(org.jboss.errai.security.shared.api.Group group)
        Get the permissions assigned to a given group.
        Parameters:
        group - The group instance
        Returns:
        The permission collection. Notice, the default permission collection is also included in the results.
      • setPermissions

        void setPermissions​(org.jboss.errai.security.shared.api.Group group,
                            PermissionCollection permissions)
        Set the group's permissions
        Parameters:
        group - The group instance
        permissions - A permission collection
      • getHomePerspective

        String getHomePerspective​(org.jboss.errai.security.shared.api.Role role)
        Get the identifier of the home perspective assigned to the given group.
        Returns:
        An existing perspective identifier
      • getHomePerspective

        String getHomePerspective​(org.jboss.errai.security.shared.api.Group group)
        Get the identifier of the home perspective assigned to the given group.
        Returns:
        An existing perspective identifier
      • setHomePerspective

        void setHomePerspective​(org.jboss.errai.security.shared.api.Role role,
                                String perspectiveId)
        Set the identifier of the home perspective assigned to the given role.
        Parameters:
        role - The target role instance
        perspectiveId - An existing perspective identifier
      • setHomePerspective

        void setHomePerspective​(org.jboss.errai.security.shared.api.Group group,
                                String perspectiveId)
        Set the identifier of the home perspective assigned to the given group.
        Parameters:
        group - The target group instance
        perspectiveId - An existing perspective identifier
      • getHomePerspective

        String getHomePerspective​(org.jboss.errai.security.shared.api.identity.User user)
        Get the identifier of the perspective this user is redirected by default.

        If the user is assigned with more than one role or group then the most priority one is taken.

        Returns:
        An existing perspective identifier
        See Also:
        getPriority(Role), getPriority(Group)
      • getHomePerspective

        String getHomePerspective()
        Gets the identifier of the default home perspective.

        This is the perspective that is returned for those roles/groups with no home perspective set.

        Returns:
        An existing perspective identifier
      • setHomePerspective

        void setHomePerspective​(String perspectiveId)
        Sets the identifier of the default home perspective.

        This is the perspective that is returned for those roles/groups with no gome perspective set.

        Parameters:
        perspectiveId - An existing perspective identifier
      • getPermissions

        PermissionCollection getPermissions()
        Get the default permissions.

        These are he permissions that are returned for those roles/groups with no permissions set.

        Returns:
        The permission collection
      • addPermission

        void addPermission​(org.jboss.errai.security.shared.api.Group group,
                           Permission permission)
        Add a single permission entry for a group.
        Parameters:
        group - The group instance
        permission - A permission instance