1. Corrected the enforcement of the readonly attribute for classes.
authorscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 11 Feb 2009 18:55:11 +0000 (18:55 +0000)
committerscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 11 Feb 2009 18:55:11 +0000 (18:55 +0000)
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

index 64b7428..ab4f803 100644 (file)
@@ -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 );