diff --git a/src/main/java/edu/stanford/protege/webprotege/authorization/BuiltInRole.java b/src/main/java/edu/stanford/protege/webprotege/authorization/BuiltInRole.java index 63cab64..15f4922 100644 --- a/src/main/java/edu/stanford/protege/webprotege/authorization/BuiltInRole.java +++ b/src/main/java/edu/stanford/protege/webprotege/authorization/BuiltInRole.java @@ -122,6 +122,8 @@ public enum BuiltInRole { CAN_EDIT(PROJECT_EDITOR, CAN_COMMENT), + CAN_EDIT_REGULAR(REGULAR_PROJECT_EDITOR, CAN_COMMENT), + CAN_MANAGE(CAN_EDIT, PROJECT_MANAGER, ISSUE_MANAGER) ; diff --git a/src/main/java/edu/stanford/protege/webprotege/authorization/GetAuthorizedActionsHandler.java b/src/main/java/edu/stanford/protege/webprotege/authorization/GetAuthorizedActionsHandler.java index a749a7e..29d9350 100644 --- a/src/main/java/edu/stanford/protege/webprotege/authorization/GetAuthorizedActionsHandler.java +++ b/src/main/java/edu/stanford/protege/webprotege/authorization/GetAuthorizedActionsHandler.java @@ -49,27 +49,7 @@ public Mono handleRequest(GetAuthorizedActionsRequ /* ToDo: Understand why we need this if else here */ -// if(request.resource().isApplication()) { -// try { -// List roleIds = tokenValidator.getTokenClaims(executionContext.jwt()).stream() -// .map(RoleId::new) -// .toList(); -// Set actions = new HashSet<>(roleOracle.getActionsAssociatedToRoles(roleIds)); -// return Mono.just(new GetAuthorizedActionsResponse(request.resource(), -// request.subject(), -// actions)); -// -// } catch (VerificationException e) { -// throw new RuntimeException(e); -// } -// }else { -// var actionClosure = accessManager.getActionClosure(request.subject(), -// request.resource()); -// return Mono.just(new GetAuthorizedActionsResponse(request.resource(), -// request.subject(), -// actionClosure)); -// } - + if(request.resource().isApplication()) { try { List roleIds = tokenValidator.getTokenClaims(executionContext.jwt()).stream() .map(RoleId::new) @@ -82,5 +62,12 @@ public Mono handleRequest(GetAuthorizedActionsRequ } catch (VerificationException e) { throw new RuntimeException(e); } + }else { + var actionClosure = accessManager.getActionClosure(request.subject(), + request.resource()); + return Mono.just(new GetAuthorizedActionsResponse(request.resource(), + request.subject(), + actionClosure)); + } } }