]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-2884: Service call to retrieve permissions for a user without having to go...
authorRichard Millet <richard.millet@berkeley.edu>
Thu, 23 Sep 2010 07:27:49 +0000 (07:27 +0000)
committerRichard Millet <richard.millet@berkeley.edu>
Thu, 23 Sep 2010 07:27:49 +0000 (07:27 +0000)
services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaStorageUtils.java

index de8e691a0a9a6e5a102c93007292412b10d5b4c4..9c7efaf0bdd94c290e831164bb1db68cb0a9eca5 100644 (file)
@@ -67,6 +67,7 @@ public class JpaStorageUtils {
     /** The Constant CS_PERSISTENCE_UNIT. */
     public final static String CS_PERSISTENCE_UNIT = "org.collectionspace.services";
     private final static String CS_AUTHZ_PERSISTENCE_UNIT = "org.collectionspace.services.authorization";
+    private final static String CS_CURRENT_USER = "0";
 
     /**
      * getEntity for given id and class
@@ -131,6 +132,12 @@ public class JpaStorageUtils {
     private static String getUserId(String csid)
                throws DocumentNotFoundException  {
        String result = null;
+       //
+       // If the CSID is null then return the currently logged in user's ID
+       //
+       if (csid.equals(CS_CURRENT_USER) == true) {
+               return AuthN.get().getUserId();
+       }
        
        //FIXME: Why can't the common jar depend on the account service?  Can we move the account
        //jaxb classes to the common "jaxb" module?