Interface WarlockGrantService

  • All Implemented Interfaces:

    
    public interface WarlockGrantService
    
                        
    Authorization and revocation, which involves elevation of privilege, must be used with GrantChecker
    - Role-owned perm
    - Role-owned role
    - User-owned perm
    - user-owned role
    
    Since:

    2021-03-05

    Author:

    trydofor

    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract void grantRole(long roleId, @NotNull() GrantType type, @NotNull() Collection<Long> grant) Grant role/perm to role to give the `grant` privilege.
      void grantRole(long refer, @NotNull() GrantType type, @NotNull() Array<Long> grant)
      abstract void purgeRole(long roleId, @NotNull() GrantType type, @NotNull() Collection<Long> grant) Revoke role/perm to role to remove the `grant` privilege.
      void purgeRole(long roleId, @NotNull() GrantType type, @NotNull() Array<Long> grant)
      abstract void grantUser(long userId, @NotNull() GrantType type, @NotNull() Collection<Long> grant) Grant role/perm to user to give the `grant` privilege.
      void grantUser(long userId, @NotNull() GrantType type, @NotNull() Array<Long> grant)
      abstract void purgeUser(long userId, @NotNull() GrantType type, @NotNull() Collection<Long> grant) Revoke role/perm to user to remove the `grant` privilege.
      void purgeUser(long userId, @NotNull() GrantType type, @NotNull() Array<Long> grant)
      abstract Map<Long, Set<Long>> entryUser(@NotNull() GrantType type, @NotNull() Collection<Long> userId) Get user granted privileges.
      Map<Long, Set<Long>> entryUser(@NotNull() GrantType type, @NotNull() Array<Long> userId)
      abstract Map<Long, Set<Long>> entryRole(@NotNull() GrantType type, @NotNull() Collection<Long> roleId) Get role granted privileges.
      Map<Long, Set<Long>> entryRole(@NotNull() GrantType type, @NotNull() Array<Long> roleId)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • grantRole

         abstract void grantRole(long roleId, @NotNull() GrantType type, @NotNull() Collection<Long> grant)

        Grant role/perm to role to give the `grant` privilege.

        Parameters:
        roleId - roleId
        type - grant type
        grant - RoleId or PermId
      • grantRole

         void grantRole(long refer, @NotNull() GrantType type, @NotNull() Array<Long> grant)
      • purgeRole

         abstract void purgeRole(long roleId, @NotNull() GrantType type, @NotNull() Collection<Long> grant)

        Revoke role/perm to role to remove the `grant` privilege.

        Parameters:
        roleId - roleId
        type - grant type
        grant - RoleId or PermId
      • purgeRole

         void purgeRole(long roleId, @NotNull() GrantType type, @NotNull() Array<Long> grant)
      • grantUser

         abstract void grantUser(long userId, @NotNull() GrantType type, @NotNull() Collection<Long> grant)

        Grant role/perm to user to give the `grant` privilege.

        Parameters:
        userId - userId
        type - grant type
        grant - RoleId or PermId
      • grantUser

         void grantUser(long userId, @NotNull() GrantType type, @NotNull() Array<Long> grant)
      • purgeUser

         abstract void purgeUser(long userId, @NotNull() GrantType type, @NotNull() Collection<Long> grant)

        Revoke role/perm to user to remove the `grant` privilege.

        Parameters:
        userId - userId
        type - grant type
        grant - RoleId or PermId
      • purgeUser

         void purgeUser(long userId, @NotNull() GrantType type, @NotNull() Array<Long> grant)
      • entryUser

         abstract Map<Long, Set<Long>> entryUser(@NotNull() GrantType type, @NotNull() Collection<Long> userId)

        Get user granted privileges. return the map of RoleId/PermId to UserId

        Parameters:
        type - grant type
        userId - userId
        Returns:

        RoleId/PermId - UserId

      • entryRole

         abstract Map<Long, Set<Long>> entryRole(@NotNull() GrantType type, @NotNull() Collection<Long> roleId)

        Get role granted privileges. return the map of RoleId/PermId to UserId

        Parameters:
        type - grant type
        roleId - roleId
        Returns:

        RoleId/PermId - roleId