Interface PrivilegeChecker
public interface PrivilegeChecker
Checks if a role has a privilege.
-
Method Summary
Modifier and TypeMethodDescriptioncheckAllAsync(Set<Privilege> privileges, String role) Checks if a role has all the privileges.checkAllAsync(Set<Privilege> privileges, Set<String> roles) Checks if a union of the roles has all the privileges.checkAnyAsync(Privilege privilege, Set<String> roles) Checks if any of the roles has a privilege.checkAsync(Privilege privilege, String role) Checks if a role has a privilege.checkSelfPrivilegesAsync(Privilege privilege, String username) Checks if a user is the same user from self privilege.
-
Method Details
-
checkAsync
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
trueif the role has the privilege,falseotherwise.
-
checkAnyAsync
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
trueif the role has the privilege,falseotherwise.
-
checkAllAsync
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
PrivilegeCheckResultif the role has all the privileges,PrivilegeCheckResultwill contain missing privileges otherwise. The future will be completed in any case but with different results.
-
checkAllAsync
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
PrivilegeCheckResultif the roles has all the privileges,PrivilegeCheckResultwill 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
trueif the user has the privilege,falseotherwise.
-