LP1889628 SIP patron username logging config option
authorBill Erickson <berickxx@gmail.com>
Thu, 20 Aug 2020 19:04:24 +0000 (15:04 -0400)
committerJason Stephenson <jason@sigio.com>
Fri, 28 Aug 2020 12:06:14 +0000 (08:06 -0400)
Adds an option to oils_sip.xml which allows admins to activate (or not)
the login-via-username SIP support.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jason Stephenson <jason@sigio.com>
Open-ILS/examples/oils_sip.xml.example
Open-ILS/src/perlmods/lib/OpenILS/SIP.pm
docs/RELEASE_NOTES_NEXT/SIP/allow_usrname_in_patron_id.adoc

index f0edf88..9b191ed 100644 (file)
                                        <option name='patron_status_always_permit_loans' value='false' />
                                        -->
 
+                                       <!--
+                                               Allow patrons to connect to SIP services using their
+                                               username in addition to their barcode.  See the
+                                               org unit setting 'opac.barcode_regex' for configuring
+                                               what constitutes a barcode vs a username.
+                                       <option name='support_patron_username_login' value='false' />
+                                       -->
+
                                </options>
 
                 <checkin_override>
index c1c7a76..693d562 100644 (file)
@@ -272,10 +272,15 @@ sub find_patron {
     my $key  =  (@_ > 1) ? shift : 'barcode';  # if we have multiple args, the first is the key index (default barcode)
     my $patron_id = shift;
 
-    # Check for usrname or barcode in the same, simple way that the OPAC does.
-    my $bc_regex = $self->get_barcode_regex();
-    if ($key eq 'barcode' && $patron_id !~ /$bc_regex/) {
-        $key = 'usrname';
+    my $use_username = 
+        $self->get_option_value('support_patron_username_login') || '';
+
+    if (to_bool($use_username)) {
+        # Check for usrname or barcode in the same, simple way that the OPAC does.
+        my $bc_regex = $self->get_barcode_regex();
+        if ($key eq 'barcode' && $patron_id !~ /$bc_regex/) {
+            $key = 'usrname';
+        }
     }
 
     $self->verify_session;
index 671bf9d..209f22f 100644 (file)
@@ -11,3 +11,12 @@ barcode or username by comparing the field value against the
 `opac.barcode_regex` setting for the organizational unit of the logged
 in SIP2 account as configured in the oils_sip.xml file.  This is
 similar to what the OPAC does when a patron logs in.
+
+This feature requires activation.  To activate, uncomment (or add) the
+following line in the oils_sip.xml configuration file and change the 
+value from 'false' to 'true'.
+
+[source,xml]
+---------------------------------------------------------------------------
+<option name='support_patron_username_login' value='true' />
+---------------------------------------------------------------------------