Interface PrivilegeChecker


public interface PrivilegeChecker
Checks if a role has a privilege.
  • Method Details

    • checkAsync

      CompletableFuture<Boolean> checkAsync(Privilege privilege, String role)
      Checks if a role has a privilege. Including both direct and inherited privileges.
      Parameters:
      privilege - Privilege to check.
      role - Role.
      Returns:
      The future that will complete with true if the role has the privilege, false otherwise.
    • checkAnyAsync

      CompletableFuture<Boolean> checkAnyAsync(Privilege privilege, Set<String> roles)
      Checks if any of the roles has a privilege. Including both direct and inherited privileges.
      Parameters:
      privilege - Privilege to check.
      roles - Roles.
      Returns:
      The future that will complete with true if the role has the privilege, false otherwise.
    • checkAllAsync

      CompletableFuture<PrivilegeCheckResult> checkAllAsync(Set<Privilege> privileges, String role)
      Checks if a role has all the privileges. Including both direct and inherited privileges.
      Parameters:
      privileges - Privileges to check.
      role - Role.
      Returns:
      The future that will complete with PrivilegeCheckResult if the role has all the privileges, PrivilegeCheckResult will contain missing privileges otherwise. The future will be completed in any case but with different results.
    • checkAllAsync

      CompletableFuture<PrivilegeCheckResult> checkAllAsync(Set<Privilege> privileges, Set<String> roles)
      Checks if a union of the roles has all the privileges. Including both direct and inherited privileges.
      Parameters:
      privileges - Privileges to check.
      roles - Roles.
      Returns:
      The future that will complete with PrivilegeCheckResult if the roles has all the privileges, PrivilegeCheckResult will contain missing privileges otherwise. The future will be completed in any case but with different results.
    • checkSelfPrivilegesAsync

      CompletableFuture<PrivilegeCheckResult> checkSelfPrivilegesAsync(Privilege privilege, String username)
      Checks if a user is the same user from self privilege.
      Parameters:
      privilege - Privilege to check.
      username - Username.
      Returns:
      The future that will complete with true if the user has the privilege, false otherwise.