<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>A new request with request id 10824 has been created by koha-devel-request@lists.koha-community.org. Short info on the request is : <br><br>Title : Koha-devel Digest, Vol 197, Issue 9<br>Category : <br>Description : <div>Send Koha-devel mailing list submissions to<br>    koha-devel@lists.koha-community.org<br><br>To subscribe or unsubscribe via the World Wide Web, visit<br>    https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<br>or, via email, send a message with subject or body 'help' to<br>    koha-devel-request@lists.koha-community.org<br><br>You can reach the person managing the list at<br>    koha-devel-owner@lists.koha-community.org<br><br>When replying, please edit your Subject line so it is more specific<br>than "Re: Contents of Koha-devel digest..."<br><br><br>Today's Topics:<br><br>   1. Plack Middleware to isolate library branches via path<br>      (Thomas Klausner)<br>   2. Re: Plack Middleware to isolate library branches via path<br>      (dcook@prosentient.com.au)<br>   3. How to apply Lending Restrictions (Ms. Naveen Ali)<br>   4. Re: Plack Middleware to isolate library branches via path<br>      (Thomas Klausner)<br><br><br>----------------------------------------------------------------------<br><br>Message: 1<br>Date: Tue, 19 Apr 2022 14:12:45 +0200<br>From: Thomas Klausner <domm@plix.at><br>To: koha-devel@lists.koha-community.org<br>Subject: [Koha-devel] Plack Middleware to isolate library branches via<br>    path<br>Message-ID: <20220419121245.GK3952@plix.at><br>Content-Type: text/plain; charset="utf-8"<br><br>Hi!<br><br>A customer wants to access branches/branchgroups via a subpath, instead <br>of the more common / documented way of setting up a subdomain per <br>branch:<br>https://wiki.koha-community.org/wiki/Override_sysprefs_in_Apache_config<br><br>So instead of https://aaa.library.example.com/ they want <br>https://library.example.com/aaa/  (for ~10 branches)<br><br><br>This boils down to:<br>- matching the path and munging the URL<br>- setting some ENV vars (OPAC_SEARCH_LIMIT, OPAC_CSS_OVERRIDE, etc)<br>- munging the HTML generated by Koha to fix the links<br><br>While this could be implemented via carefull application of various <br>Apache modules (mod_proxy, mod_rewrite, mod_proxy_html) I feel more <br>comfortable implementing this in Perl in a Plack Middleware.<br>The result is not very pretty, but seems to work (see attached code...)<br><br>But to load the middleware, I have to enable it in /etc/koha/plack.psgi <br>and thus change a core file (or copy upstream plack.psgi and edit the <br>copy, which still means that we'll have to apply our changes after each <br>update)<br><br>In theory we could add some config to load custom Middlewares, but as <br>the load order of Middlewares is very relevant, this seems hardly doable <br>- unless we start with one middleware config slot at the location I need :-)<br><br>Anyway, I think we'll just go with maintaining a custom plack.psgi, <br>unless anybody here has any other ideas / best practices / solutions on <br>how to mount library branches at location/sub-dirs... I'm also not sure <br>if this feature is on any roadmap etc.<br><br><br>Greetings,<br>domm<br><br><br>-- <br>#!/usr/bin/perl                             https://domm.plix.at<br>for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}<br>-------------- next part --------------<br>A non-text attachment was scrubbed...<br>Name: IsolateBranch.pm<br>Type: text/x-perl<br>Size: 2447 bytes<br>Desc: not available<br>URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20220419/6cc9a231/attachment-0001.pm><br><br>------------------------------<br><br>Message: 2<br>Date: Wed, 20 Apr 2022 10:56:36 +1000<br>From: <dcook@prosentient.com.au><br>To: "'Thomas Klausner'" <domm@plix.at>,<br>    <koha-devel@lists.koha-community.org><br>Subject: Re: [Koha-devel] Plack Middleware to isolate library branches<br>    via path<br>Message-ID: <016501d85451$81be5bd0$853b1370$@prosentient.com.au><br>Content-Type: text/plain;    charset="us-ascii"<br><br>Hi Thomas,<br><br>The timing of your email is interesting! I was just reflecting the other day<br>about how Koha can't work off anything but the root path. <br><br>However, it's not something that I'm likely to ever work on, as the<br>subdomains work fine for us. (Although self-checkout URLs using branch-based<br>paths could be very useful for us.)<br><br>I have a Catalyst app where I use the out of the box method $c->uri_for<br>which constructs an absolute URI using the application root (e.g. /aaa/),<br>but that would require rewriting Koha's templates. I use that same strategy<br>for some of my other web apps, which lets the deployment be quite flexible.<br>(In the case of Catalyst, it auto-detects the path based on the location of<br>the controller. With CGI apps I have, I rely on a configuration variable.)<br><br>With your solution, how do you handle Javascript navigation that doesn't<br>necessarily rely on HTML? (I can't think of any examples off the top of my<br>head but I'm sure they must exist, although perhaps only on the Staff<br>Interface...)<br><br>David Cook<br>Senior Software Engineer<br>Prosentient Systems<br>Suite 7.03<br>6a Glen St<br>Milsons Point NSW 2061<br>Australia<br><br>Office: 02 9212 0899<br>Online: 02 8005 0595<br><br>-----Original Message-----<br>From: Koha-devel <koha-devel-bounces@lists.koha-community.org> On Behalf Of<br>Thomas Klausner<br>Sent: Tuesday, 19 April 2022 10:13 PM<br>To: koha-devel@lists.koha-community.org<br>Subject: [Koha-devel] Plack Middleware to isolate library branches via path<br><br>Hi!<br><br>A customer wants to access branches/branchgroups via a subpath, instead of<br>the more common / documented way of setting up a subdomain per<br>branch:<br>https://wiki.koha-community.org/wiki/Override_sysprefs_in_Apache_config<br><br>So instead of https://aaa.library.example.com/ they want<br>https://library.example.com/aaa/  (for ~10 branches)<br><br><br>This boils down to:<br>- matching the path and munging the URL<br>- setting some ENV vars (OPAC_SEARCH_LIMIT, OPAC_CSS_OVERRIDE, etc)<br>- munging the HTML generated by Koha to fix the links<br><br>While this could be implemented via carefull application of various <br>Apache modules (mod_proxy, mod_rewrite, mod_proxy_html) I feel more <br>comfortable implementing this in Perl in a Plack Middleware.<br>The result is not very pretty, but seems to work (see attached code...)<br><br>But to load the middleware, I have to enable it in /etc/koha/plack.psgi <br>and thus change a core file (or copy upstream plack.psgi and edit the <br>copy, which still means that we'll have to apply our changes after each <br>update)<br><br>In theory we could add some config to load custom Middlewares, but as <br>the load order of Middlewares is very relevant, this seems hardly doable <br>- unless we start with one middleware config slot at the location I need :-)<br><br>Anyway, I think we'll just go with maintaining a custom plack.psgi, <br>unless anybody here has any other ideas / best practices / solutions on <br>how to mount library branches at location/sub-dirs... I'm also not sure <br>if this feature is on any roadmap etc.<br><br><br>Greetings,<br>domm<br><br><br>-- <br>#!/usr/bin/perl                             https://domm.plix.at<br>for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}<br><br><br><br>------------------------------<br><br>Message: 3<br>Date: Wed, 20 Apr 2022 10:10:49 +0500 (PKT)<br>From: "Ms. Naveen Ali" <naveen@neduet.edu.pk><br>To: koha-devel@lists.koha-community.org, koha@lists.katipo.co.nz<br>Subject: [Koha-devel] How to apply Lending Restrictions<br>Message-ID:<br>    <1673116620.1147324.1650431449576.JavaMail.zimbra@neduet.edu.pk><br>Content-Type: text/plain; charset="utf-8"<br><br>Dear members, <br><br>I would like to put forward the following scenario. <br><br>Our library has three sections where books are loaned and they each have different policies. All library members have access to all sections. <br><br>I would like to implement the library policy where <br><br><br>    1. staff of one section can issue books of that section only <br>    2. books should also be returned to the same section. <br>There is no general rule; just specific rules for each section. <br><br>This is what I am doing. <br><br>I have provided Permanent Library of all book items as the main library name and the Current Library as the section library. <br><br>I am trying to use the following global parameters to implement our library policies, but am not successful. <br><br><br><br>    * AllowReturnToBranch <br>    <br>Allow items to be checked in "Only at the item the library is from" (I understand this to be the current library) <br><br><br>    * AutomaticItemReturn <br>    <br>Don't automatically transfer items to their home library when they are checked in. (I understand the home library to be the permanent library) <br><br><br><br>    * CircControl Use the calendar and circulation rules of "the library the item is from" (I understand this to be the current library) <br>    <br><br><br><br><br>    * HomeOrHoldingBranch <br>    <br>Use the checkout and fines rules of " the items holding library" (I understand holding library = current library and home library = permanent library) <br><br>*It seems that CircControl and HomeOrHoldingBranch paramter are same. <br><br>I also can't find how to restrict a library staff member from Setting his library to any that he wants by using the "Set Library" Option available. <br>Also how to prevent staff from issuing books belonging to other libraries. <br><br><br>With best regards, <br><br>Naveen Ali <br><br>ITM-JE (EAKL) <br>Inst Representative for <br>HEC Digital Library Resources. <br>NEDUET, Karachi. <br><br><br>-------------- next part --------------<br>An HTML attachment was scrubbed...<br>URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20220420/33a00775/attachment-0001.htm><br><br>------------------------------<br><br>Message: 4<br>Date: Wed, 20 Apr 2022 10:00:31 +0200<br>From: Thomas Klausner <domm@plix.at><br>To: koha-devel@lists.koha-community.org<br>Subject: Re: [Koha-devel] Plack Middleware to isolate library branches<br>    via path<br>Message-ID: <20220420080031.GO3952@plix.at><br>Content-Type: text/plain; charset=us-ascii<br><br>Hi!<br><br>On Wed, Apr 20, 2022 at 10:56:36AM +1000, dcook@prosentient.com.au wrote:<br> <br>> The timing of your email is interesting! I was just reflecting the other day<br>> about how Koha can't work off anything but the root path. <br><br>:-)<br><br>> I have a Catalyst app where I use the out of the box method $c->uri_for<br>> which constructs an absolute URI using the application root (e.g. /aaa/),<br>> but that would require rewriting Koha's templates. I use that same strategy<br><br>Most web frameworks and/or router implementations provide methods to <br>generate links, and those methods should honor HTTP headers like <br>X-Forwarded-For etc. I usually use Plack::Middleware::ReverseProxyPath<br>https://metacpan.org/pod/Plack::Middleware::ReverseProxyPath<br>which uses X-Forwarded-Script-Name and X-Traversal-Path to allow for a <br>very flexible setup, if the apps/routers used support those headers to <br>generate links (Catalyst does, AFAIK)<br><br>But I guess the reason that Koha cannot use somethink like this is that <br>it generates a lot of links via literal strings in the templates. And <br>changing this to use a method/function would be a lot of work!<br><br>Which is why I choose the rather ugly and probably not very stable <br>approach to fix (hopefully..) the generated URLs after rendering using a <br>regex...<br><br>> With your solution, how do you handle Javascript navigation that doesn't<br>> necessarily rely on HTML? (I can't think of any examples off the top of my<br>> head but I'm sure they must exist, although perhaps only on the Staff<br>> Interface...)<br><br>Currently we don't, but the users are as of now only starting to test <br>the path-based branches. We'll see what problems they'll encounter. And <br>we're only using this branch separation on the OPAC.<br><br>Greetings,<br>domm<br><br>-- <br>#!/usr/bin/perl                             https://domm.plix.at<br>for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}<br><br><br>------------------------------<br><br>Subject: Digest Footer<br><br>_______________________________________________<br>Koha-devel mailing list<br>Koha-devel@lists.koha-community.org<br>https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<br>website : https://www.koha-community.org/<br>git : https://git.koha-community.org/<br>bugs : https://bugs.koha-community.org/<br><br><br>------------------------------<br><br>End of Koha-devel Digest, Vol 197, Issue 9<br>******************************************<br></div><br><br>NOTE: You are receiving this mail because, the Requester/Technician wanted you to get notified on this request creation.<br></body></html>