diff --git a/config/vufind/Demo.ini b/config/vufind/Demo.ini index 12a41119e8b9f92dea28f5eac05ddfe91d20a06c..7bc2c9686fbeba1a9b8f3ba55b7733833b8563e5 100644 --- a/config/vufind/Demo.ini +++ b/config/vufind/Demo.ini @@ -16,4 +16,12 @@ ILLRequests = true source = VuFind ; Query to use for record retrieval -query = "*:*" \ No newline at end of file +query = "*:*" + +; This section can be used to create a set of fake users recognized by the +; Demo driver. If it is uncommented, only usernames and passwords listed here +; will be recognized for ILS login. If it is commented out, all username/password +; combinations will be accepted. +;[Users] +;user1 = "password1" +;user2 = "password2" \ No newline at end of file diff --git a/module/VuFind/src/VuFind/ILS/Driver/Demo.php b/module/VuFind/src/VuFind/ILS/Driver/Demo.php index f765b99e4474cb52beb2a558d3be29e88b2a682c..f628194583c88685a38f4fa122f06e6193017e99 100644 --- a/module/VuFind/src/VuFind/ILS/Driver/Demo.php +++ b/module/VuFind/src/VuFind/ILS/Driver/Demo.php @@ -573,6 +573,13 @@ class Demo extends AbstractBase */ public function patronLogin($barcode, $password) { + if (isset($this->config['Users'])) { + if (!isset($this->config['Users'][$barcode]) + || $password !== $this->config['Users'][$barcode] + ) { + return null; + } + } $user = []; $user['id'] = trim($barcode); @@ -599,7 +606,7 @@ class Demo extends AbstractBase public function getMyProfile($patron) { $patron = [ - 'firstname' => 'Lib', + 'firstname' => 'Lib-' . $patron['cat_username'], 'lastname' => 'Rarian', 'address1' => 'Somewhere...', 'address2' => 'Over the Rainbow',