Bug 22061: Add RESTPublicAPI syspref
authorTomas Cohen Arazi <tomascohen@theke.io>
Wed, 2 Jan 2019 18:05:10 +0000 (15:05 -0300)
committerNick Clemens <nick@bywatersolutions.com>
Mon, 28 Jan 2019 15:45:54 +0000 (15:45 +0000)
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

installer/data/mysql/atomicupdate/bug_22061_public_api.perl [new file with mode: 0644]
installer/data/mysql/sysprefs.sql
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/web_services.pref

diff --git a/installer/data/mysql/atomicupdate/bug_22061_public_api.perl b/installer/data/mysql/atomicupdate/bug_22061_public_api.perl
new file mode 100644 (file)
index 0000000..8187eaa
--- /dev/null
@@ -0,0 +1,14 @@
+$DBversion = 'XXX';  # will be replaced by the RM
+if( CheckVersion( $DBversion ) ) {
+
+    $dbh->do(q{
+        INSERT IGNORE INTO systempreferences
+            ( variable, value, options, explanation, type )
+        VALUES
+            ('RESTPublicAPI','1',NULL,'If enabled, the REST API will expose the /public endpoints.','YesNo')
+    });
+
+    # Always end with this (adjust the bug info)
+    SetVersion( $DBversion );
+    print "Upgrade to $DBversion done (Bug 22061 - Add a /public namespace that can be switched on/off)\n";
+}
index 79fa815..7d01d92 100644 (file)
@@ -490,6 +490,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('ReservesNeedReturns','1','','If ON, a hold placed on an item available in this library must be checked-in, otherwise, a hold on a specific item, that is in the library & available is considered available','YesNo'),
 ('RESTdefaultPageSize','20','','Default page size for endpoints listing objects','Integer'),
 ('RESTOAuth2ClientCredentials','0',NULL,'If enabled, the OAuth2 client credentials flow is enabled for the REST API.','YesNo'),
+('RESTPublicAPI','1',NULL,'If enabled, the REST API will expose the /public endpoints.','YesNo'),
 ('RestrictedPageLocalIPs','',NULL,'Beginning of IP addresses considered as local (comma separated ex: "127.0.0,127.0.2")','Free'),
 ('RestrictedPageContent','',NULL,'HTML content of the restricted page','TextArea'),
 ('RestrictedPageTitle','',NULL,'Title of the restricted page (breadcrumb and header)','Free'),
index c216052..0bf9194 100644 (file)
@@ -11,6 +11,12 @@ Web services:
                   yes: Enable
                   no: "Disable"
             - "the OAuth2 client credentials grant for the REST API. Requires Net::OAuth2::AuthorizationServer installed. [EXPERIMENTAL]"
+        -
+            - pref: RESTPublicAPI
+              choices:
+                  yes: Enable
+                  no: "Disable"
+            - "the /public namespace of the API."
     OAI-PMH:
         -
             - pref: OAI-PMH