From f8978f1627abec67a2f3c889aa1e7399fa46e805 Mon Sep 17 00:00:00 2001 From: Norbert Pomaroli Date: Fri, 7 Oct 2022 12:30:04 +0200 Subject: [PATCH] Fixes after code review --- .../mesh/core/endpoint/RolePermissionHandlingEndpoint.java | 3 +++ .../endpoint/RolePermissionHandlingProjectEndpoint.java | 3 +++ .../gentics/mesh/core/data/dao/impl/RoleDaoWrapperImpl.java | 2 +- .../src/main/java/com/gentics/mesh/core/rest/Examples.java | 6 +++++- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/gentics/mesh/core/endpoint/RolePermissionHandlingEndpoint.java b/core/src/main/java/com/gentics/mesh/core/endpoint/RolePermissionHandlingEndpoint.java index 4822de0bb2..6b5065fcb3 100644 --- a/core/src/main/java/com/gentics/mesh/core/endpoint/RolePermissionHandlingEndpoint.java +++ b/core/src/main/java/com/gentics/mesh/core/endpoint/RolePermissionHandlingEndpoint.java @@ -13,6 +13,9 @@ import com.gentics.mesh.rest.InternalEndpointRoute; import com.gentics.mesh.router.route.AbstractInternalEndpoint; +/** + * Abstract endpoint implementation with methods that add routes for getting/granting/revoking role permissions + */ public abstract class RolePermissionHandlingEndpoint extends AbstractInternalEndpoint { protected RolePermissionHandlingEndpoint(String basePath, MeshAuthChainImpl chain) { diff --git a/core/src/main/java/com/gentics/mesh/core/endpoint/RolePermissionHandlingProjectEndpoint.java b/core/src/main/java/com/gentics/mesh/core/endpoint/RolePermissionHandlingProjectEndpoint.java index 4aef6da2ca..bdd6ffe2d2 100644 --- a/core/src/main/java/com/gentics/mesh/core/endpoint/RolePermissionHandlingProjectEndpoint.java +++ b/core/src/main/java/com/gentics/mesh/core/endpoint/RolePermissionHandlingProjectEndpoint.java @@ -14,6 +14,9 @@ import com.gentics.mesh.rest.InternalEndpointRoute; import com.gentics.mesh.router.route.AbstractProjectEndpoint; +/** + * Abstract endpoint implementation with methods that add routes for getting/granting/revoking role permissions + */ public abstract class RolePermissionHandlingProjectEndpoint extends AbstractProjectEndpoint { protected RolePermissionHandlingProjectEndpoint(String basePath, MeshAuthChainImpl chain, diff --git a/mdm/orientdb-wrapper/src/main/java/com/gentics/mesh/core/data/dao/impl/RoleDaoWrapperImpl.java b/mdm/orientdb-wrapper/src/main/java/com/gentics/mesh/core/data/dao/impl/RoleDaoWrapperImpl.java index 46316a9a7f..5d601b797d 100644 --- a/mdm/orientdb-wrapper/src/main/java/com/gentics/mesh/core/data/dao/impl/RoleDaoWrapperImpl.java +++ b/mdm/orientdb-wrapper/src/main/java/com/gentics/mesh/core/data/dao/impl/RoleDaoWrapperImpl.java @@ -111,8 +111,8 @@ public boolean revokeRolePermissions(Set roles, HibBaseElement element, if (allowedRoles != null) { for (HibRole role : roles) { permissionRevoked = allowedRoles.remove(role.getUuid()) || permissionRevoked; - vertex.setRoleUuidForPerm(permission, allowedRoles); } + vertex.setRoleUuidForPerm(permission, allowedRoles); } } diff --git a/rest-model/src/main/java/com/gentics/mesh/core/rest/Examples.java b/rest-model/src/main/java/com/gentics/mesh/core/rest/Examples.java index b551adcfd9..1def6709eb 100644 --- a/rest-model/src/main/java/com/gentics/mesh/core/rest/Examples.java +++ b/rest-model/src/main/java/com/gentics/mesh/core/rest/Examples.java @@ -278,7 +278,7 @@ public static RoleReference roleRef() { public static RoleReference roleRef2() { RoleReference ref = new RoleReference(); - ref.setUuid(uuid4()); + ref.setUuid(uuid5()); ref.setName("editor"); return ref; } @@ -328,4 +328,8 @@ public static String uuid4() { return "d84a6f054a3f4ed68a6f054a3f1ed635"; } + public static String uuid5() { + return "01ed2f8647421b2b85891e5204d53f1b"; + } + }