From d1b8657609c7e306d9cdb68d395fdef1301f5491 Mon Sep 17 00:00:00 2001 From: scottmk Date: Wed, 11 Feb 2009 18:55:11 +0000 Subject: [PATCH] 1. Corrected the enforcement of the readonly attribute for classes. It was backwards, but harmlessly so because the enforcement is redundant. 2. Reversed the default for the "virtual" attribute of a field. Formerly it defaulted to true; now it defaults to false. git-svn-id: svn://svn.open-ils.org/ILS/trunk@12150 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/c-apps/oils_cstore.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Open-ILS/src/c-apps/oils_cstore.c b/Open-ILS/src/c-apps/oils_cstore.c index 64b742802d..ab4f80325b 100644 --- a/Open-ILS/src/c-apps/oils_cstore.c +++ b/Open-ILS/src/c-apps/oils_cstore.c @@ -1309,7 +1309,9 @@ static jsonObject* doCreate(osrfMethodContext* ctx, int* err ) { return jsonNULL; } - if (osrfHashGet( meta, "readonly" ) && strncasecmp("true", osrfHashGet( meta, "readonly" ), 4)) { + // The following test is harmless but redundant. If a class is + // readonly, we don't register a create method for it. + if( str_is_true( osrfHashGet( meta, "readonly" ) ) ) { osrfAppSessionStatus( ctx->session, OSRF_STATUS_BADREQUEST, @@ -3516,7 +3518,9 @@ static jsonObject* doUpdate(osrfMethodContext* ctx, int* err ) { return jsonNULL; } - if (osrfHashGet( meta, "readonly" ) && strncasecmp("true", osrfHashGet( meta, "readonly" ), 4)) { + // The following test is harmless but redundant. If a class is + // readonly, we don't register an update method for it. + if( str_is_true( osrfHashGet( meta, "readonly" ) ) ) { osrfAppSessionStatus( ctx->session, OSRF_STATUS_BADREQUEST, @@ -3675,7 +3679,9 @@ static jsonObject* doDelete(osrfMethodContext* ctx, int* err ) { return jsonNULL; } - if (osrfHashGet( meta, "readonly" ) && strncasecmp("true", osrfHashGet( meta, "readonly" ), 4)) { + // The following test is harmless but redundant. If a class is + // readonly, we don't register a delete method for it. + if( str_is_true( osrfHashGet( meta, "readonly" ) ) ) { osrfAppSessionStatus( ctx->session, OSRF_STATUS_BADREQUEST, @@ -3787,10 +3793,10 @@ static jsonObject* oilsMakeFieldmapperFromResult( dbi_result result, osrfHash* m /* fetch the fieldmapper index */ if( (_f = osrfHashGet(fields, (char*)columnName)) ) { - char* virt = (char*)osrfHashGet(_f, "virtual"); - if ( !virt || !(strcmp( virt, "true" )) ) continue; + if ( str_is_true( osrfHashGet(_f, "virtual") ) ) + continue; - char* pos = (char*)osrfHashGet(_f, "array_position"); + const char* pos = (char*)osrfHashGet(_f, "array_position"); if ( !pos ) continue; fmIndex = atoi( pos ); -- 2.11.0