[open-ils-commits] [GIT] Evergreen ILS branch master updated. 5dff6311f57bebf391647b3f3d1a67ffe01c5e75

Evergreen Git git at git.evergreen-ils.org
Mon Apr 9 14:17:44 EDT 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  5dff6311f57bebf391647b3f3d1a67ffe01c5e75 (commit)
      from  3e4ebdcda4030e4d6e86fe466a7c2845179ab9ef (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 5dff6311f57bebf391647b3f3d1a67ffe01c5e75
Author: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>
Date:   Mon Apr 9 11:27:53 2012 -0400

    Avoid too-strict controller checks when fleshing for cstore, reporter-store
    
    Move controller-verificiation from the beginning of recursive
    doFieldmapperSearch() to nearer the end, right before we recurse, so we
    only check the child class's controller if we're pcrud.  If we're not
    pcrud, code that calls doFieldmapperSearch() from the outside will have
    already done appropriate testing of the controller.
    
    Signed-off-by: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>

diff --git a/Open-ILS/src/c-apps/oils_sql.c b/Open-ILS/src/c-apps/oils_sql.c
index 24795b0..902a4e0 100644
--- a/Open-ILS/src/c-apps/oils_sql.c
+++ b/Open-ILS/src/c-apps/oils_sql.c
@@ -5585,27 +5585,10 @@ static jsonObject* doFieldmapperSearch( osrfMethodContext* ctx, osrfHash* class_
 	char *methodtype = osrfHashGet( (osrfHash *) ctx->method->userData, "methodtype" );
 	char *inside_verify = osrfHashGet( (osrfHash*) ctx->session->userData, "inside_verify" );
 	int need_to_verify = (inside_verify ? !atoi(inside_verify) : 1);
-	int has_controller = osrfStringArrayContains(osrfHashGet(class_meta, "controller"), modulename);
 
 	int i_respond_directly = 0;
 	int flesh_depth = 0;
 
-	// XXX This can be redundant with another instance of the same test that happens
-	// within the functions that call doFieldmapperSearch(), but we have it here to
-	// prevent any non-pcrud-controlled classes from being fleshed on.
-	//
-	// TODO To avoid redundancy, move this block to right before we recurse,
-	// and change the class we're checking to the one we're /about/ to search for,
-	// not the one we're currently searching for.
-	if (
-		(!has_controller && !enforce_pcrud) // cstore client-level case: we require the controller, period
-		|| (!has_controller && enforce_pcrud && need_to_verify) // pcrud case: we require the controller in need_to_verify mode
-	) {
-		osrfLogInfo(OSRF_LOG_MARK, "%s is not listed as a controller for %s, moving on",
-			modulename, core_class);
-		return jsonNewObjectType( JSON_ARRAY );	/* empty */
-	}
-
 	char* sql = buildSELECT( where_hash, query_hash, class_meta, ctx );
 	if( !sql ) {
 		osrfLogDebug( OSRF_LOG_MARK, "Problem building query, returning NULL" );
@@ -5782,6 +5765,21 @@ static jsonObject* doFieldmapperSearch( osrfMethodContext* ctx, osrfHash* class_
 							fields, osrfHashGet( class_meta, "primarykey" ) );
 					}
 
+					int kid_has_controller = osrfStringArrayContains( osrfHashGet(kid_idl, "controller"), modulename );
+					// fleshing pcrud case: we require the controller in need_to_verify mode
+					if ( !kid_has_controller && enforce_pcrud && need_to_verify ) {
+						osrfLogInfo( OSRF_LOG_MARK, "%s is not listed as a controller for %s; moving on", modulename, core_class );
+
+						jsonObjectSetIndex(
+							cur,
+							(unsigned long) atoi( osrfHashGet(field, "array_position") ),
+							jsonNewObjectType(
+								!strcmp( reltype, "has_many" ) ? JSON_ARRAY : JSON_NULL
+							)
+						);
+						continue;
+					}
+
 					osrfStringArray* link_map = osrfHashGet( kid_link, "map" );
 
 					if( link_map->size > 0 ) {

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/src/c-apps/oils_sql.c |   32 +++++++++++++++-----------------
 1 files changed, 15 insertions(+), 17 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list