Bug 20624: Add RESTOAuth2ClientCredentials syspref
authorTomas Cohen Arazi <tomascohen@theke.io>
Wed, 2 May 2018 14:20:37 +0000 (11:20 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 9 May 2018 15:56:01 +0000 (12:56 -0300)
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
installer/data/mysql/atomicupdate/bug_20624_disable_oauth.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_20624_disable_oauth.perl b/installer/data/mysql/atomicupdate/bug_20624_disable_oauth.perl
new file mode 100644 (file)
index 0000000..79bc904
--- /dev/null
@@ -0,0 +1,12 @@
+$DBversion = "XXX";
+if(CheckVersion($DBversion)) {
+
+    $dbh->do(q{
+        INSERT IGNORE INTO systempreferences (`variable`,`value`,`options`,`explanation`,`type`)
+        VALUES
+            ('RESTOAuth2ClientCredentials','0',NULL,'If enabled, the OAuth2 client credentials flow is enabled for the REST API.','YesNo');
+    });
+
+    print "Upgrade to $DBversion done (Bug 20624 - Disable OAuth2 client credentials grant by default)\n";
+    SetVersion($DBversion);
+}
index 4a594f0..d12791b 100644 (file)
@@ -467,6 +467,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('ReservesMaxPickUpDelay','7','','Define the Maximum delay to pick up an item on hold','Integer'),
 ('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'),
 ('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 82f7501..d9ad25f 100644 (file)
@@ -4,7 +4,13 @@ Web services:
             - "Set the default number of results returned by the REST API endpoints to"
             - pref: "RESTdefaultPageSize"
               class: integer
-            - "per page"
+            - "per page."
+        -
+            - pref: RESTOAuth2ClientCredentials
+              choices:
+                  yes: Enable
+                  no: "Disable"
+            - "the OAuth2 client credentials grant for the REST API."
     OAI-PMH:
         -
             - pref: OAI-PMH