Skip to content

Commit

Permalink
clean up security advisor
Browse files Browse the repository at this point in the history
  • Loading branch information
ottenhoff committed Apr 18, 2024
1 parent bcaec88 commit cefbb63
Showing 1 changed file with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,21 +193,14 @@ public boolean isCriterionMet(Criterion criterion) throws UnknownCriterionTypeEx
protected Object doSecureGradebookAction(SecureGradebookActionCallback callback) throws Exception {
final String contextId = contextId();

SecurityAdvisor yesMan = new SecurityAdvisor() {
public SecurityAdvice isAllowed(String userId, String function, String reference) {
String compTo;
if (contextId.startsWith("/site/")) {
compTo = contextId;
} else {
compTo = "/site/" + contextId;
}
SecurityAdvisor yesMan = (userId, function, reference) -> {
String compTo = contextId.startsWith("/site/") ? contextId : "/site/" + contextId;

if (reference.equals(compTo) && (PERM_VIEW_OWN_GRADES.equals(function) ||
PERM_EDIT_ASSIGNMENTS.equals(function))) {
return SecurityAdvice.ALLOWED;
} else {
return SecurityAdvice.PASS;
}
if (reference.equals(compTo) && (PERM_VIEW_OWN_GRADES.equals(function) ||
PERM_EDIT_ASSIGNMENTS.equals(function))) {
return SecurityAdvisor.SecurityAdvice.ALLOWED;
} else {
return SecurityAdvisor.SecurityAdvice.PASS;
}
};

Expand Down

0 comments on commit cefbb63

Please sign in to comment.