Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,22 @@ public interface AuthorizationManager<U extends AbstractUser, S extends Session<

void setRoleResolver(RoleResolver roleResolver);

/**
* Checks if the given right is granted for the provided context (Session)
* @param session the session to check against
* @param right the right to be validated
* @return true when the session is granted the provided right
*/
boolean checkRightInContext(S session, String right);

/**
* Checks if the right is defined in the system. If not, the right is automatically granted. Otherwise, it delegates to {@link #checkRightInContext(S, String)}.
* @param session the session to check against
* @param right the right to be validated
* @return true when the session is granted the provided right
*/
boolean checkRightInContextIfDefined(S session, String right);

default boolean checkRightInContext(S session, String right, String usernameOnBehalfOf) {
// onBehalfOf is not supported by default
if (usernameOnBehalfOf == null || usernameOnBehalfOf.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ public boolean checkRightInContext(Session session, String right) {
return true;
}

@Override
public boolean checkRightInContextIfDefined(Session session, String right) {
return true;
}

@Override
public boolean checkRightInContext(Session session, String right, String usernameOnBehalfOf) {
return true;
Expand Down