]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-2141
authorSanjay Dalal <sanjay.dalal@berkeley.edu>
Mon, 14 Jun 2010 21:00:25 +0000 (21:00 +0000)
committerSanjay Dalal <sanjay.dalal@berkeley.edu>
Mon, 14 Jun 2010 21:00:25 +0000 (21:00 +0000)
when deleting a role its association(s) with permissions are deleted
test: authorization-mgt

M    authorization/PermissionResource.java
M    authorization/RoleResource.java
M    authorization/PermissionRoleSubResource.java

services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/PermissionResource.java
services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/PermissionRoleSubResource.java
services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/RoleResource.java

index 08457e975d0fb3ff27c9701f4a2d6b32d0d42990..41636b45dd0660005f9f76914d709a4fd1b38464 100644 (file)
@@ -348,14 +348,14 @@ public class PermissionResource
             throw new WebApplicationException(response);
         }
         try {
-            //FIXME ideally the following two ops shoudl be in the same tx CSPACE-658
+            //FIXME ideally the following two ops should be in the same tx CSPACE-658
             //delete all relationships for this permission
             PermissionRoleSubResource subResource =
                     new PermissionRoleSubResource(PermissionRoleSubResource.PERMISSION_PERMROLE_SERVICE);
             subResource.deletePermissionRole(csid, SubjectType.ROLE);
-            //delete permissions at the provider too
-            //at the PermissionRoleSubResource/DocHandler levels, there is no visibility
-            //if permission is deleted
+            //delete permissions in the authz provider too
+            //at the PermissionRoleSubResource/DocHandler level, there is no visibility
+            //if permission is deleted, so do it here
             AuthorizationDelegate.deletePermissions(csid);
 
             ServiceContext<Permission, Permission> ctx = createServiceContext((Permission) null, Permission.class);
index a6195c8f0bbf3d75cf47aa888ee1fed84a3b323f..6215c8df02d40769b8b6f1bb108120a41ff037d6 100644 (file)
@@ -196,7 +196,7 @@ public class PermissionRoleSubResource
      * csid of object (permission/role) and subject (role/permission)
      * @param csid
      * @param subject
-     * @param input with role and permissions to delete
+     * @param input with role and permission relationships to delete
      * @return
      * @throws Exception
      */
index 03e0767d8b89e2a1d3255201dac09f44dcd3ef9f..f94135106262522b3ecc2df20c80f84123066422 100644 (file)
@@ -350,6 +350,12 @@ public class RoleResource
             throw new WebApplicationException(response);
         }
         try {
+            //FIXME ideally the following two ops should be in the same tx CSPACE-658
+            //delete all relationships for this permission
+            PermissionRoleSubResource subResource =
+                    new PermissionRoleSubResource(PermissionRoleSubResource.ROLE_PERMROLE_SERVICE);
+            subResource.deletePermissionRole(csid, SubjectType.PERMISSION);
+
             ServiceContext ctx = createServiceContext((Role) null, Role.class);
             ((JpaStorageClientImpl) getStorageClient(ctx)).deleteWhere(ctx, csid);
             return Response.status(HttpResponseCodes.SC_OK).build();