From a268006a3201654e77b4fa51ec5205cb17459c48 Mon Sep 17 00:00:00 2001 From: erickson Date: Wed, 16 Feb 2011 15:07:04 +0000 Subject: [PATCH] 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 git-svn-id: svn://svn.open-ils.org/ILS/trunk@19447 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/c-apps/oils_auth.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/c-apps/oils_auth.c b/Open-ILS/src/c-apps/oils_auth.c index eb20fb7118..4e7b20b11e 100644 --- a/Open-ILS/src/c-apps/oils_auth.c +++ b/Open-ILS/src/c-apps/oils_auth.c @@ -807,8 +807,17 @@ int oilsAuthResetTimeout( osrfMethodContext* ctx ) { 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 @@ int oilsAuthSessionRetrieve( osrfMethodContext* ctx ) { 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 -- 2.43.2