expose PermissionChecker and use this

This commit is contained in:
Aaron
2023-06-16 10:25:01 +02:00
parent cc67b99c8b
commit 48e4fa637e
4 changed files with 12 additions and 11 deletions

View File

@@ -22,7 +22,7 @@ public interface PermissionSubject {
* @return whether or not the subject has the permission
*/
default boolean hasPermission(String permission) {
return getPermissionValue(permission).toBooleanOrElse(false);
return this.getPermissionChecker().test(permission);
}
/**
@@ -31,14 +31,14 @@ public interface PermissionSubject {
* @param permission the permission
* @return the value the permission is set to
*/
TriState getPermissionValue(String permission);
default TriState getPermissionValue(String permission) {
return this.getPermissionChecker().value(permission);
}
/**
* Gets the permission checker for the subject.
*
* @return subject's permission checker
*/
default PermissionChecker getPermissionChecker() {
return this::getPermissionValue;
}
PermissionChecker getPermissionChecker();
}