Bug 22132: Add RESTBasicAuth syspref
authorTomas Cohen Arazi <tomascohen@theke.io>
Tue, 15 Jan 2019 16:22:53 +0000 (13:22 -0300)
committerLucas Gass <lucas@bywatersolutions.com>
Thu, 7 Feb 2019 23:15:55 +0000 (23:15 +0000)
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 3ffed7d55a1d77df2d3c0748614434866612ed24)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 3741027605b61b0e988fd7e8df8ec60dc5fe5b99)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

installer/data/mysql/atomicupdate/bug_22132_basic_auth.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_22132_basic_auth.perl b/installer/data/mysql/atomicupdate/bug_22132_basic_auth.perl
new file mode 100644 (file)
index 0000000..ae98472
--- /dev/null
@@ -0,0 +1,13 @@
+$DBversion = 'XXX';
+if( CheckVersion( $DBversion ) ) {
+
+    $dbh->do(q{
+        INSERT IGNORE INTO systempreferences
+            (variable, value, options, explanation, type )
+        VALUES
+            ('RESTBasicAuth','0',NULL,'If enabled, Basic authentication is enabled for the REST API.','YesNo')
+    });
+
+    SetVersion( $DBversion );
+    print "Upgrade to $DBversion done (Bug 22132 - Add Basic authentication)\n";
+}
index 0623715..cc05a74 100644 (file)
@@ -467,6 +467,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('ReservesControlBranch','PatronLibrary','ItemHomeLibrary|PatronLibrary','Branch checked for members reservations rights','Choice'),
 ('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'),
+('RESTBasicAuth','0',NULL,'If enabled, Basic authentication is enabled for the REST API.','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'),
index 15fc834..8abda28 100644 (file)
@@ -1,6 +1,12 @@
 Web services:
     REST API:
         -
+            - pref: RESTBasicAuth
+              choices:
+                  yes: Enable
+                  no: "Disable"
+            - '<a href="https://www.w3.org/Protocols/HTTP/1.0/spec.html#BasicAA" target="_blank">Basic authentication</a> for the REST API.'
+        -
             - "Set the default number of results returned by the REST API endpoints to"
             - pref: "RESTdefaultPageSize"
               class: integer