From: scottmk Date: Wed, 11 Feb 2009 18:55:11 +0000 (+0000) Subject: 1. Corrected the enforcement of the readonly attribute for classes. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=d1b8657609c7e306d9cdb68d395fdef1301f5491;p=evergreen%2Ftadl.git 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 --- 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 );