From: Demian K. <dem...@vi...> - 2016-10-05 16:31:43
|
Regarding the translation issue, if you change "escapeHtml" to "transEsc" in <?=$this->escapeHtml($renewDetails['sysMessage'])?> in this line: https://github.com/vufind-org/vufind/blob/352cf812266c21533ba6a51eebe2222562c76414/themes/bootstrap3/templates/myresearch/checkedout.phtml#L48 then the string should go through the translation system, and you may be able to address it through the es.ini instead of through the driver code. Regarding everything else, it sounds like you have some things to think about. If you need more input from me on any of these issues, please let me know and I'll be happy to continue the conversation! - Demian From: MARTINEZ ZUÑIGA, ENRIQUE [mailto:en...@it...] Sent: Wednesday, October 05, 2016 10:58 AM To: Demian Katz; vufind general Subject: RE: Aleph driver DLF loginPatron Thank you Demian! Please see my inline comments ** Best regards! Enrique. De: Demian Katz [mailto:dem...@vi...] Enviado el: miércoles, 05 de octubre de 2016 08:39 a.m. Para: MARTINEZ ZUÑIGA, ENRIQUE <en...@it...<mailto:en...@it...>>; vufind general <vuf...@li...<mailto:vuf...@li...>> Asunto: RE: Aleph driver DLF loginPatron Thanks for sharing this! It looks like there are a few independent things going on here. It might make sense to open separate pull requests for some of them so they can be discussed and approved/merged independently of one another. 1.) You've added some debug output to parsetable(). I'm guessing this may have been a temporary measure; I'm not sure if we would want that level of verbose debug output most of the time... but if you think this would indeed be valuable and others agree, it would be easy enough to incorporate. ** Missed to clear my debug code, but considering your idea. 2.) You've commented out doXRequest, but is that really necessary? There's already logic in place that throws an exception if the method gets called when the X-Server setting is disabled in the .ini file. I think that is probably sufficient for confirming that this method is never called. Commenting out getMyProfileX also seems unnecessary since the existing code should already prevent this from being called when X-Server is disabled. ** I've commented out temporarily to not to break the logic while understanding it. Disabling on ini file doesn't suffice, still calling on some points. 3.) You have added some code to parse the status string and include extra details in the getHolding return value. I'm not sure if this is of general use or if it is specific to your local customizations. ** I think It's only for my case but can't say for sure. Will think on a configurable way. 4.) You have made some adjustments to getMyTransactions. Obviously, these would not be appropriate for all users, so this would have to be made configurable somehow if we wanted to make this a standard feature. I also wonder if there may be some sort of bug in here, as I notice that getRealId() gets called twice on values rather than once - first there is a lookup at the top of the function, and then the result of that lookup gets passed to a second lookup when setting the 'id' value in the return array. I'm also not sure whether the barcode manipulation here is necessary or appropriate. On a related note, the user ID processing in getMyHolds seems inconsistent. I'd also recommend making getRealId() protected rather than public since I don't believe that it needs to be called from outside of the class itself. ** I've noticed the double call too, but can't get into it. I'll review the procedure more in deep. Will make changes you suggest. 5.) As you say, there are some substantial changes to getMyProfileDLF. This includes uncommenting the extraction of the address4/address5 fields (which seems unnecessary, as the variables are still not used for anything) and the addition of an $sms variable that is also not actually used. Do you think it would be possible/appropriate to add a configuration section that can be used to specify how to map DLF fields to VuFind fields in order to make this function more generic and easier to customize without changing code? ** I'll try to find how to make it more flexible, maybe looking at other drivers to see how it is made, and how VuFind handle patrons information on a generic manner. 6.) The patronLogin() method has been changed significantly - and I'm not sure how generally applicable this behavior is. Again, it's a question of whether some config setting should be introduced, or whether this can actually work for everyone. ** Is more a workaround. I'll review it in detail. 7.) You've added a custom message in placeHold(). ** In this case is because I didn't find who to translate the alert message that Aleph returns when a patron can't successfully make the reservation. Any advice is welcome (on the theme side only?). 8.) You've modified barcodeToID to return a variable that is not defined in the scope of the function - presumably a bug. ** Or by mistake. Anyhow I don't find how it could work with RESTful. Anyway, perhaps some other Aleph users can comment with a better understanding of the system to suggest how this could be made customizable and which parts of the changes are useful to a general audience - but hopefully this analysis of your changes at least shows where some of the talking points might be, and reveals a couple of possible bugs for you to investigate. ** Hope someone jump in and comment. Congratulations on the beta launch, thanks again for sharing your work, and please let me know if I can be of any further assistance! ** Thanks! One other observation regarding the beta site: when I access it, I end up seeing a mix of Spanish and English. I think that VuFind is detecting my browser language as English and translating the VuFind-specific strings, but your custom theme is not designed to support multiple languages. If you only plan on supporting one language with your site, it may actually make the user experience less confusing if you comment out the other languages in config.ini (though one might also argue that seeing some things in another language might be at least somewhat helpful to a speaker of that language). ** I'll look into it, there is other people working on the theme side. ** Regarding making it a RESTful only version (with no authentication, I know) of the driver, are any possibilities. I'd try but no luck! - Demian From: MARTINEZ ZUÑIGA, ENRIQUE [mailto:en...@it...] Sent: Tuesday, October 04, 2016 4:22 PM To: Demian Katz; vufind general Subject: RE: Aleph driver DLF loginPatron Hello, I'm back! This week we open early access to the beta version of the site, feel free to visit and comment: http://opac.biblio.iteso.mx/vifund. I have solved most of the pitfalls I've came across. I'll try to summarize the most important: (I've attached Aleph.php file so you can comment) We are on Aleph 22, LDAP authentication, MARC feed through OAI-PMH own provider, using Restful api. I've made some changes on Aleph.php driver: - Commented the inner code from the doXRequest function to ensure that I don't is used anywhere. Also commented getMyProfileX. - The function barcodeToID calls x-server to find the patron ID based on his barcode, I've bypassed it to avoid x-server. - We authenticate patrons with LDAP. To match patron legacy IDs, I've added the getRealId function at bottom to match the correct one from a CSV. - On getMyProfileDLF changed order and some fields, as ours differs from original code. I think we can add this driver as a RESTful only. How can I add a AlephRestfull ILS driver? (To remove all X-Server references from it). Forward to your comments, Enrique Martínez Sistemas de Información Biblioteca Dr. Jorge Villalobos Padilla, S.J. Universidad ITESO De: Demian Katz [mailto:dem...@vi...] Enviado el: viernes, 24 de junio de 2016 12:25 p.m. Para: MARTINEZ ZUÑIGA, ENRIQUE <en...@it...<mailto:en...@it...>>; vufind general <vuf...@li...<mailto:vuf...@li...>> Asunto: RE: Aleph driver DLF loginPatron Enrique, You might find it helpful to take a look at this method: https://github.com/vufind-org/vufind/blob/308eef7ee5df0398be8a4545d3df0570fd1cf4bc/module/VuFind/src/VuFind/Controller/MyResearchController.php#L865 getDriverForILSRecord() is called by both the checked out items and holds actions - it's supposed to load the record driver associated with an ILS transaction, based on the ID value embedded in the data. If there is no ID, it's instead supposed to create a fake driver as a placeholder. I'm not sure exactly why you would be seeing the error you report, but it's probably tied up in this code somehow - either there is some rare bug we've never seen before, or else there is something wrong with the data being passed back that is causing an invalid object to be created. You might find it helpful to do some debug dumping here to see what's going on. Let me know if you need more details! Regarding the LDAP attributes, you can use this section of config.ini to map certain LDAP attributes to fields in the user database table: https://github.com/vufind-org/vufind/blob/master/config/vufind/config.ini#L479 These values can then be retrieved through the User object of the logged-in user. I don't think this is readily available to the Aleph driver by default, but if you need to gain access, you could most likely subclass the existing driver and adjust the factory to inject the user object. Let me know if you need more details. - Demian From: MARTINEZ ZUÑIGA, ENRIQUE [mailto:en...@it...] Sent: Thursday, June 23, 2016 4:11 PM To: vufind general Subject: Re: [VuFind-General] Aleph driver DLF loginPatron Hi All! I think I'm getting close! I had made some small modifications to the patronLogin function to skip the doXRequest call. It's working in some way. Have to see how affects in other authentication modes. I can see user's Profile and Fines, but when try to see "Checked Out Items" or "Holds and Recalls" it fails, and the logs only shows these: "CRIT (2): ID not set!". I think from RecordDriver/SolrDefault.php and don't know why. On Check Out Items makes the following 3 calls before it stops: http://aleph:port/rest-dlf/patron/123456/patronInformation/address/ http://aleph:port/rest-dlf/patron/123456/patronStatus/registration/<http://aleph:port/rest-dlf/patron/003833/patronStatus/registration/> http://aleph:port/rest-dlf/patron/123456/circulationActions/loans/?view=full<http://aleph:port/rest-dlf/patron/003833/circulationActions/loans/?view=full> On Holds and Recalls makes the following 3 calls before it stops, the first two are the same as Check Out Items: http://aleph:port/rest-dlf/patron/123456/patronInformation/address/ http://aleph:port/rest-dlf/patron/123456/patronStatus/registration/<http://aleph:port/rest-dlf/patron/003833/patronStatus/registration/> http://aleph:port /rest-dlf/patron/123456/circulationActions/requests/holds/?view=full<http://aleph:port%20/rest-dlf/patron/123456/circulationActions/requests/holds/?view=full> Besides, I can't find the name on DLF queries, only in z304-address-1 but I rather prefer the LDAP or Z303 data instead. Another question I have is how I can get the parameters from LDAP authentication to pass it to the process. At the bottom is the code's first approach. Regards, Enrique ------------------------------------- /** * Patron Login * * This is responsible for authenticating a patron against the catalog. * * @param string $user The patron username * @param string $password The patron's password * * @throws ILSException * @return mixed Associative array of patron info on successful login, * null on unsuccessful login. */ public function patronLogin($user, $password) { if ($password == null) { $temp = ["id" => $user]; $temp['college'] = $this->useradm; return $this->getMyProfile($temp); } if ($this->xserver_enabled) { try { $xml = $this->doXRequest( 'bor-auth', [ 'library' => $this->useradm, 'bor_id' => $user, 'verification' => $password ], true ); } catch (\Exception $ex) { if (strpos($ex->getMessage(), 'Error in Verification') !== false) { return null; } throw new ILSException($ex->getMessage()); } } else { $temp = ["id" => $user]; /* maybe adding data from LDAP or other authentication before exit $temp['firstname'] = (string) $firstname; $temp['lastname'] = (string) $lastname; $temp['cat_username'] = (string) $user; $temp['cat_password'] = $password; $temp['email'] = (string) $email; //... other possible fields? */ return $this->getMyProfile($temp); } $patron = []; $name = $xml->z303->{'z303-name'}; if (strstr($name, ",")) { list($lastName, $firstName) = explode(",", $name); } else { $lastName = $name; $firstName = ""; } $email_addr = $xml->z304->{'z304-email-address'}; $id = $xml->z303->{'z303-id'}; $home_lib = $xml->z303->z303_home_library; // Default the college to the useradm library and overwrite it if the // home_lib exists $patron['college'] = $this->useradm; if (($home_lib != '') && (array_key_exists("$home_lib", $this->sublibadm))) { if ($this->sublibadm["$home_lib"] != '') { $patron['college'] = $this->sublibadm["$home_lib"]; } } $patron['id'] = (string) $id; $patron['barcode'] = (string) $user; $patron['firstname'] = (string) $firstName; $patron['lastname'] = (string) $lastName; $patron['cat_username'] = (string) $user; $patron['cat_password'] = $password; $patron['email'] = (string) $email_addr; $patron['major'] = null; printf('6</br>'); return $patron; } ------------------------------------- De: Filipe Bento [mailto:fbento@EBSCO.COM] Enviado el: jueves, 23 de junio de 2016 09:23 a.m. Para: MARTINEZ ZUÑIGA, ENRIQUE <en...@it...<mailto:en...@it...>>; Demian Katz <dem...@vi...<mailto:dem...@vi...>>; vufind general <vuf...@li...<mailto:vuf...@li...>> Asunto: RE: Aleph driver DLF loginPatron Thanks Enrique! Ah, yes, meant to write that: patrons authenticate or LDAP could return ALEPH's ID00 (given that you have it stored at the central auth / IdP / active directory; yes, legacy accounts or systems are always the culprits for this non-direct OTB integration). PS: not "my" code, by no means ;) -- but I know what you meant, the code I've shared :) But I do know my way around it, if that helps (and all the troubleshooting associated with environment to get it running - well, anyone that has RESTful DLF is up & running is good [if needed this ID translation, by passing the need for the [paid] X-Server - RESTful DLF is a native component of ALEPH]). From: MARTINEZ ZUÑIGA, ENRIQUE [mailto:en...@it...] Sent: 23 de junho de 2016 15:07 To: Filipe Bento <fbento@EBSCO.COM<mailto:fbento@EBSCO.COM>>; Demian Katz <dem...@vi...<mailto:dem...@vi...>>; vufind general <vuf...@li...<mailto:vuf...@li...>> Subject: RE: Aleph driver DLF loginPatron Thank you Filipe, for sharing this! This is true for 95% of our user's accounts, most exceptions are staff's old accounts or alumni. But I think we can handle this having a second LDAP field for this case, ie. libraryAltID, that holds the real Aleph ID00 and its existence, or difference from the standard ID, force it to use as ID for the RESTful-DLF API code in the driver. - Now looking at your code - Enrique. De: Filipe Bento [mailto:fbento@EBSCO.COM] Enviado el: jueves, 23 de junio de 2016 08:44 a.m. Para: Demian Katz <dem...@vi...<mailto:dem...@vi...>>; MARTINEZ ZUÑIGA, ENRIQUE <en...@it...<mailto:en...@it...>>; vufind general <vuf...@li...<mailto:vuf...@li...>> Asunto: RE: Aleph driver DLF loginPatron Hi Enrique, Demian, all, Most confess that I haven't touch this for a while, nevertheless here are some lessons learnt ALEPH - EDS integration via RESTful DLF. If patrons authenticate against LDAP with an ID equal to ALEPH ID (ID00), then you're good, you don't need X-Server: just use that ID for the RESTful DLF calls. If not, then, OTB the only way to get that value (ID00) from an alternative key (ID01 or ID02), would be calling X-Server. I say "out-of-the-box", because there's actually a way to get that value straight out of ORACLE, without violating any of ORACLE runtime license or Ex Libris maintenance contract clauses, enhancing this way ALEPH's RESTful DLF API: Latest / updated fork: https://github.com/michal-ruzicka/EDS-Aleph-API-Adapter I need to revisit VuFind's ALEPH RESTful DLF driver, though, but really hope that this helps, happy to implement or debug it. Thanks, Filipe From: Demian Katz [mailto:dem...@vi...] Sent: 23 de junho de 2016 13:56 To: MARTINEZ ZUÑIGA, ENRIQUE <en...@it...<mailto:en...@it...>>; vufind general <vuf...@li...<mailto:vuf...@li...>> Subject: Re: [VuFind-General] Aleph driver DLF loginPatron As you say, it appears that there is no standard path to bypass the X-Server in patronLogin(), even when it is supposed to be disabled. Without knowing a lot about the history of this driver, I'm not sure why this is the case, though I can speculate that there might be a limitation to the DLF API that makes it impossible to do authentication without using X-Server. I notice that there is a strange special case near the top of patronLogin() that proxies getMyProfile() when a null password value is sent in. I'm not sure what this is for, but it might offer a clue about a possible way to bypass the X-Server. The return value for is similar to the return value for getMyProfile, so proxying the profile call may be helpful. However, if you don't actually have the ability to do real authentication against the username and password, that could be a disadvantage - but on the other hand, if LDAP is already taking care of the authentication piece, it may not matter in your particular scenario. Let me know if you need more specific help and I can try to make more suggestions. It would also be helpful to hear from some of the Aleph driver developers. If you don't get any more replies here, it might be worth cross-posting to the vufind-tech list, where you might get the attention of other developers more easily. - Demian From: MARTINEZ ZUÑIGA, ENRIQUE [mailto:en...@it...] Sent: Wednesday, June 22, 2016 5:51 PM To: vufind general Subject: [VuFind-General] Aleph driver DLF loginPatron Hi All! As far as I can get, this is what I've found: A little of context on my installation: - We are migrating from Aleph 20 to 22 - Harvesting through OAI-PMH custom provider the MARC. [Check] - Authenticating with LDAP. [Check] - Aleph driver on DLF-RESTFUL (avoiding X-Server). I'm stocked here. Following the code, I reach to the function patronLogin on Aleph Driver, it makes a doXRequest call, even that is not enabled, and throws a ILSException. Here stops the function, and the user get this message "Connection to the library management system failed". I think that a condition is missing to skip the X-Server request, but can't figure out how, yet. Maybe something like the getMyProfile function. Can you help me on this? Regards, Enrique Martínez. Biblioteca Dr. Jorge Villalobos Padilla, S.J. ITESO, Universidad jesuita de Guadalajara Tlaquepaque, Jalisco, México. |