From: miker Date: Mon, 15 Dec 2008 19:38:03 +0000 (+0000) Subject: try building a new param array instead of removing the auth token from the original X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=fbbd8bd7c45b3f501e38ad4b2b8c55abe561c031;p=Evergreen.git try building a new param array instead of removing the auth token from the original git-svn-id: svn://svn.open-ils.org/ILS/trunk@11581 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/c-apps/oils_cstore.c b/Open-ILS/src/c-apps/oils_cstore.c index 80f6c916c2..1072852dea 100644 --- a/Open-ILS/src/c-apps/oils_cstore.c +++ b/Open-ILS/src/c-apps/oils_cstore.c @@ -669,7 +669,10 @@ int dispatchCRUDMethod ( osrfMethodContext* ctx ) { jsonObject* _p = jsonObjectClone( ctx->params ); #ifdef PCRUD - jsonObjectRemoveIndex(_p, 0); + jsonObjectFree(_p); + _p = jsonParseString("[]"); + jsonObjectPush(_p, jsonObjectClone(jsonObjectGetIndex(ctx->params, 1))); + jsonObjectPush(_p, jsonObjectClone(jsonObjectGetIndex(ctx->params, 2))); #endif obj = doFieldmapperSearch(ctx, class_obj, _p, &err); @@ -690,28 +693,26 @@ int dispatchCRUDMethod ( osrfMethodContext* ctx ) { } else if (!strcmp(methodtype, "id_list")) { - int _opt_pos = 1; -#ifdef PCRUD - _opt_pos = 2; -#endif - jsonObject* _p = jsonObjectClone( ctx->params ); #ifdef PCRUD - jsonObjectRemoveIndex(_p, 0); + jsonObjectFree(_p); + _p = jsonParseString("[]"); + jsonObjectPush(_p, jsonObjectClone(jsonObjectGetIndex(ctx->params, 1))); + jsonObjectPush(_p, jsonObjectClone(jsonObjectGetIndex(ctx->params, 2))); #endif - if (jsonObjectGetIndex( _p, _opt_pos )) { - jsonObjectRemoveKey( jsonObjectGetIndex( _p, _opt_pos ), "flesh" ); - jsonObjectRemoveKey( jsonObjectGetIndex( _p, _opt_pos ), "flesh_columns" ); + if (jsonObjectGetIndex( _p, 1 )) { + jsonObjectRemoveKey( jsonObjectGetIndex( _p, 1 ), "flesh" ); + jsonObjectRemoveKey( jsonObjectGetIndex( _p, 1 ), "flesh_columns" ); } else { - jsonObjectSetIndex( _p, _opt_pos, jsonNewObjectType(JSON_HASH) ); + jsonObjectSetIndex( _p, 1, jsonNewObjectType(JSON_HASH) ); } growing_buffer* sel_list = buffer_init(64); buffer_fadd(sel_list, "{ \"%s\":[\"%s\"] }", osrfHashGet( class_obj, "classname" ), osrfHashGet( class_obj, "primarykey" )); char* _s = buffer_release(sel_list); - jsonObjectSetKey( jsonObjectGetIndex( _p, _opt_pos ), "select", jsonParseString(_s) ); + jsonObjectSetKey( jsonObjectGetIndex( _p, 1 ), "select", jsonParseString(_s) ); osrfLogDebug(OSRF_LOG_MARK, "%s: Select qualifer set to [%s]", MODULENAME, _s); free(_s);