Skip to content

Commit 83957d4

Browse files
committed
concord-server: make Permission#isPermitted non-static
1 parent 2e2af89 commit 83957d4

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

server/impl/src/main/java/com/walmartlabs/concord/server/org/OrganizationManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ private static void assertAdmin() {
295295
}
296296

297297
private static void assertPermission(Permission p) {
298-
if (Permission.isPermitted(p)) {
298+
if (p.isPermitted()) {
299299
return;
300300
}
301301

server/impl/src/main/java/com/walmartlabs/concord/server/process/ProcessResourceV2.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ private ProcessFilter createProcessFilter(UUID orgId,
253253
} else {
254254
// we got a query that is not limited to any specific org
255255
// let's check if we can return all processes from all orgs or if we should limit it to the user's orgs
256-
boolean canSeeAllOrgs = Roles.isAdmin() || Permission.isPermitted(Permission.GET_PROCESS_QUEUE_ALL_ORGS);
256+
boolean canSeeAllOrgs = Roles.isAdmin() || Permission.GET_PROCESS_QUEUE_ALL_ORGS.isPermitted();
257257
if (!canSeeAllOrgs) {
258258
// non-admin users can only see their org's processes or processes w/o projects
259259
orgIds = getCurrentUserOrgIds();

server/impl/src/main/java/com/walmartlabs/concord/server/security/Permission.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public String getKey() {
5858
return key;
5959
}
6060

61-
public static boolean isPermitted(Permission p) {
62-
return SecurityUtils.isPermitted(p.getKey());
61+
public boolean isPermitted() {
62+
return SecurityUtils.isPermitted(this.getKey());
6363
}
6464
}

server/impl/src/main/java/com/walmartlabs/concord/server/security/apikey/ApiKeyResource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public CreateApiKeyResponse create(@PathParam("name") @ConcordKey String name) {
112112
public CreateApiKeyResponse create(@Valid CreateApiKeyRequest req) {
113113
String key = req.getKey();
114114

115-
if (!Permission.isPermitted(Permission.API_KEY_SPECIFY_VALUE)) {
115+
if (key != null && !Permission.API_KEY_SPECIFY_VALUE.isPermitted()) {
116116
throw new UnauthorizedException("Not allowed to specify the API key value.");
117117
}
118118

0 commit comments

Comments
 (0)