[open-ils-commits] r19448 - branches/rel_2_1/Open-ILS/src/c-apps (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Feb 16 10:08:03 EST 2011


Author: erickson
Date: 2011-02-16 10:08:01 -0500 (Wed, 16 Feb 2011)
New Revision: 19448

Modified:
   branches/rel_2_1/Open-ILS/src/c-apps/oils_auth.c
Log:
added option to open-ils.auth.session.retrieve to return the full cached object, which includes the auth time (cache timeout) of the cached user object

Modified: branches/rel_2_1/Open-ILS/src/c-apps/oils_auth.c
===================================================================
--- branches/rel_2_1/Open-ILS/src/c-apps/oils_auth.c	2011-02-16 15:07:04 UTC (rev 19447)
+++ branches/rel_2_1/Open-ILS/src/c-apps/oils_auth.c	2011-02-16 15:08:01 UTC (rev 19448)
@@ -807,8 +807,17 @@
 
 int oilsAuthSessionRetrieve( osrfMethodContext* ctx ) {
 	OSRF_METHOD_VERIFY_CONTEXT(ctx);
+    bool returnFull = false;
 
 	const char* authToken = jsonObjectGetString( jsonObjectGetIndex(ctx->params, 0));
+
+    if(ctx->params->size > 1) {
+        // caller wants full cached object, with authtime, etc.
+        const char* rt = jsonObjectGetString(jsonObjectGetIndex(ctx->params, 1));
+        if(rt && strcmp(rt, "0") != 0) 
+            returnFull = true;
+    }
+
 	jsonObject* cacheObj = NULL;
 	oilsEvent* evt = NULL;
 
@@ -828,7 +837,10 @@
 			cacheObj = osrfCacheGetObject( key );
 			if(cacheObj) {
 				// Return a copy of the cached user object
-				osrfAppRespondComplete( ctx, jsonObjectGetKeyConst( cacheObj, "userobj"));
+                if(returnFull)
+				    osrfAppRespondComplete( ctx, cacheObj);
+                else
+				    osrfAppRespondComplete( ctx, jsonObjectGetKeyConst( cacheObj, "userobj"));
 				jsonObjectFree(cacheObj);
 			} else {
 				// Auth token is invalid or expired



More information about the open-ils-commits mailing list