From: Richard Millet Date: Thu, 26 Aug 2010 20:03:11 +0000 (+0000) Subject: CSPACE-2727: AuthZ management resources were not responding to gets of /accountroles... X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=638080e155d07d991475642c21bb2c9c96096150;p=tmp%2Fjakarta-migration.git CSPACE-2727: AuthZ management resources were not responding to gets of /accountroles/{csid}, /permroles/{csid} correctly. These gets now return the details of the relationship records. --- diff --git a/services/account/service/src/main/java/org/collectionspace/services/account/AccountResource.java b/services/account/service/src/main/java/org/collectionspace/services/account/AccountResource.java index 43a024aa1..e40ca7ca9 100644 --- a/services/account/service/src/main/java/org/collectionspace/services/account/AccountResource.java +++ b/services/account/service/src/main/java/org/collectionspace/services/account/AccountResource.java @@ -436,10 +436,10 @@ public class AccountResource } @GET - @Path("{csid}/accountroles/{accrolecsid}") + @Path("{csid}/accountroles/{id}") public AccountRoleRel getAccountRole( @PathParam("csid") String accCsid, - @PathParam("accrolecsid") String accrolecsid) { + @PathParam("id") String accrolecsid) { if (logger.isDebugEnabled()) { logger.debug("getAccountRole with accCsid=" + accCsid); } diff --git a/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/PermissionResource.java b/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/PermissionResource.java index 367076a05..61e200837 100644 --- a/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/PermissionResource.java +++ b/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/PermissionResource.java @@ -443,10 +443,10 @@ public class PermissionResource } @GET - @Path("{csid}/permroles/{permrolecsid}") + @Path("{csid}/permroles/{id}") public PermissionRoleRel getPermissionRole( @PathParam("csid") String permCsid, - @PathParam("permrolecsid") String permrolecsid) { + @PathParam("id") String permrolecsid) { if (logger.isDebugEnabled()) { logger.debug("getPermissionRole with permCsid=" + permCsid); } diff --git a/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/RoleResource.java b/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/RoleResource.java index 4aa34d569..bc337392e 100644 --- a/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/RoleResource.java +++ b/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/RoleResource.java @@ -505,10 +505,10 @@ public class RoleResource } @GET - @Path("{csid}/permroles/{permrolecsid}") + @Path("{csid}/permroles/{id}") public PermissionRoleRel getRolePermission( @PathParam("csid") String roleCsid, - @PathParam("permrolecsid") String permrolecsid) { + @PathParam("id") String permrolecsid) { if (logger.isDebugEnabled()) { logger.debug("getRolePermission with roleCsid=" + roleCsid); } diff --git a/services/authorization/jaxb/src/main/resources/accounts_roles.xsd b/services/authorization/jaxb/src/main/resources/accounts_roles.xsd index ca932e36c..2acd1c593 100644 --- a/services/authorization/jaxb/src/main/resources/accounts_roles.xsd +++ b/services/authorization/jaxb/src/main/resources/accounts_roles.xsd @@ -68,6 +68,7 @@ + @@ -76,6 +77,7 @@ + AccountRole defines association between account and role in CollectionSpace diff --git a/services/authorization/jaxb/src/main/resources/permissions_roles.xsd b/services/authorization/jaxb/src/main/resources/permissions_roles.xsd index e31f41e55..b3574025b 100644 --- a/services/authorization/jaxb/src/main/resources/permissions_roles.xsd +++ b/services/authorization/jaxb/src/main/resources/permissions_roles.xsd @@ -68,6 +68,7 @@ + diff --git a/services/common/src/main/java/org/collectionspace/services/common/security/SecurityInterceptor.java b/services/common/src/main/java/org/collectionspace/services/common/security/SecurityInterceptor.java index 152e4af67..69c262452 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/security/SecurityInterceptor.java +++ b/services/common/src/main/java/org/collectionspace/services/common/security/SecurityInterceptor.java @@ -160,12 +160,12 @@ public class SecurityInterceptor implements PreProcessInterceptor { for (String pathParamName : pathParams.keySet()) { //assumption : path params for csid for any entity has substring csid in name String pathParamValue = pathParams.get(pathParamName).get(0); - if ((pathParamName.toLowerCase().indexOf("ms") > -1)) { + if ((pathParamName.toLowerCase().indexOf("csid") > -1)) { //replace csids with wildcard uriPath = uriPath.replace(pathParamValue, "*"); } - if ((pathParamName.toLowerCase().indexOf("csid") > -1)) { - //replace csids with wildcard + if ((pathParamName.toLowerCase().indexOf("id") > -1)) { + //replace id with wildcard uriPath = uriPath.replace(pathParamValue, "*"); } if ((pathParamName.toLowerCase().indexOf("predicate") > -1)) { @@ -177,6 +177,10 @@ public class SecurityInterceptor implements PreProcessInterceptor { uriPath = uriPath.replace("urn:cspace:name(" + pathParamValue + ")", "*"); } + if ((pathParamName.toLowerCase().indexOf("ms") > -1)) { + //replace csids with wildcard + uriPath = uriPath.replace(pathParamValue, "*"); + } } uriPath = uriPath.replace("//", "/"); return uriPath;