Class DefaultPermissionManager

    • Method Detail

      • getDefaultVotingStrategy

        public org.uberfire.security.authz.VotingStrategy getDefaultVotingStrategy()
        Description copied from interface: PermissionManager
        Gets the default voting strategy.
        Specified by:
        getDefaultVotingStrategy in interface PermissionManager
        Returns:
        A VotingStrategy instance
      • getVotingAlgorithm

        public VotingAlgorithm getVotingAlgorithm​(org.uberfire.security.authz.VotingStrategy votingStrategy)
        Description copied from interface: PermissionManager
        Gets the VotingAlgorithm implementation associated with the specified VotingStrategy.
        Specified by:
        getVotingAlgorithm in interface PermissionManager
        Parameters:
        votingStrategy - The voting strategy
        Returns:
        The voting algorithm instance
      • createPermission

        public Permission createPermission​(String name,
                                           boolean granted)
        Description copied from interface: PermissionManager
        Creates a permission instance.
        Specified by:
        createPermission in interface PermissionManager
        Parameters:
        name - The name of the permission to create
        granted - true=granted, false=denied
        Returns:
        A brand new permission instance
      • createPermission

        public Permission createPermission​(org.uberfire.security.Resource resource,
                                           org.uberfire.security.ResourceAction action,
                                           boolean granted)
        Description copied from interface: PermissionManager
        Creates a permission instance representing an action on a given resource..
        Specified by:
        createPermission in interface PermissionManager
        Parameters:
        resource - The resource instance
        action - The action to check. If null then an "access" permission is created. The term access refers to the ability to reach, read, view ... the resource, depending on the resource type.
        Returns:
        A permission instance
      • createPermission

        public Permission createPermission​(org.uberfire.security.ResourceType resourceType,
                                           org.uberfire.security.ResourceAction action,
                                           boolean granted)
        Description copied from interface: PermissionManager
        Creates a permission instance representing an action on a given resource..
        Specified by:
        createPermission in interface PermissionManager
        Parameters:
        resourceType - The resource type
        action - The action to check. If null then an "access" permission is created. The term access refers to the ability to reach, read, view ... the resource, depending on the resource type.
        Returns:
        A permission instance
      • checkPermission

        public AuthorizationResult checkPermission​(Permission permission,
                                                   org.jboss.errai.security.shared.api.identity.User user)
        Description copied from interface: PermissionManager
        Check if the given permission is granted to the specified user.

        NOTE: If voting is required (users with more than one role and/or group assigned) then the default voting strategy is used

        Specified by:
        checkPermission in interface PermissionManager
        Parameters:
        permission - The permission to check
        user - The user instance
        Returns:
        The authorization result: GRANTED / DENIED / ABSTAIN
        See Also:
        AuthorizationResult
      • checkPermission

        public AuthorizationResult checkPermission​(Permission permission,
                                                   org.jboss.errai.security.shared.api.identity.User user,
                                                   org.uberfire.security.authz.VotingStrategy votingStrategy)
        Description copied from interface: PermissionManager
        Check if the given permission is granted to the specified user.
        Specified by:
        checkPermission in interface PermissionManager
        Parameters:
        permission - The permission to check
        user - The user instance
        votingStrategy - The voting strategy to use when voting is required (users with more than one role and/or group assigned). If null then the default voting strategy is used.
        Returns:
        The authorization result: GRANTED / DENIED / ABSTAIN
      • _checkPermission

        protected AuthorizationResult _checkPermission​(Permission permission,
                                                       org.jboss.errai.security.shared.api.identity.User user,
                                                       org.uberfire.security.authz.VotingStrategy votingStrategy)
      • _checkRoleAndGroupPermissions

        protected List<AuthorizationResult> _checkRoleAndGroupPermissions​(Permission permission,
                                                                          org.jboss.errai.security.shared.api.identity.User user)
      • resolvePermissions

        public PermissionCollection resolvePermissions​(org.jboss.errai.security.shared.api.identity.User user,
                                                       org.uberfire.security.authz.VotingStrategy votingStrategy)
        Description copied from interface: PermissionManager
        Get the permissions assigned to a given user.

        Usually, the user's permissions is obtained by mixing all the permissions assigned to each role and group instance the user belongs to.

        Every interface implementation must take into account the voting strategy specified, which is used to resolve permission collision.

        Specified by:
        resolvePermissions in interface PermissionManager
        Parameters:
        user - The user instance
        votingStrategy - The voting strategy
        Returns:
        The permission collection
        See Also:
        AuthorizationPolicy.getPriority(Role), AuthorizationPolicy.getPriority(Group)
      • invalidate

        public void invalidate​(org.jboss.errai.security.shared.api.identity.User user)
        Description copied from interface: PermissionManager
        Invalidate user related authorization data cached
        Specified by:
        invalidate in interface PermissionManager
        Parameters:
        user - user to invalidate cache