From e31cde9d4aa84e67b0910f19647c51513aa343eb Mon Sep 17 00:00:00 2001 From: Richard Millet Date: Thu, 23 Sep 2010 07:27:49 +0000 Subject: [PATCH] CSPACE-2884: Service call to retrieve permissions for a user without having to go through all the roles --- .../services/common/storage/jpa/JpaStorageUtils.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaStorageUtils.java b/services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaStorageUtils.java index de8e691a0..9c7efaf0b 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaStorageUtils.java +++ b/services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaStorageUtils.java @@ -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? -- 2.47.3