[Koha-devel] A case against some uses of C4::Context->userenv

Michael Hafen michael.hafen at washk12.org
Mon Sep 30 19:22:17 CEST 2019


What about the 'Search My Library First' and 'Independent Branches'
settings?  Those are dependent right now on reading the users branch from
userenv.  I'm not familiar enough with the code base to know where else
those settings would get the users branch; is it kept in a cookie?

On Sun, Sep 29, 2019 at 6:03 PM <dcook at prosentient.com.au> wrote:

> Totally agree too. Also makes unit testing a million times easier.
>
>
>
> David Cook
>
> Systems Librarian
>
> Prosentient Systems
>
> 72/330 Wattle St
>
> Ultimo, NSW 2007
>
> Australia
>
>
>
> Office: 02 9212 0899
>
> Direct: 02 8005 0595
>
>
>
> *From:* Koha-devel <koha-devel-bounces at lists.koha-community.org> *On
> Behalf Of *Renvoize, Martin
> *Sent:* Saturday, 28 September 2019 3:14 AM
> *To:* Tomas Cohen Arazi <tomascohen at gmail.com>
> *Cc:* koha-devel <koha-devel at lists.koha-community.org>
> *Subject:* Re: [Koha-devel] A case against some uses of
> C4::Context->userenv
>
>
>
> I generally agree here,  I'd rather explicitly pass things like this into
> objects on instantiation and die if they're not present.. that way we catch
> cases of missing environments early and as you state, userenv harks back
> the CGI days and we should generally be moving forward and away from those
> patterns in my opinion.
>
>
>
>
>
>
> *Martin Renvoize*
>
> <https://www.ptfs-europe.com/>
>
> Development Team Manager
>
>
>
>
>
> *Phone:* +44 (0) 1483 378728
>
> *Mobile:* +44 (0) 7725 985 636
>
> *Email:* martin.renvoize at ptfs-europe.com
>
> *Fax:* +44 (0) 800 756 6384
>
> www.ptfs-europe.com
>
>
>
>
>
>
>
>
>
> Registered in the United Kingdom No. 06416372   VAT Reg No. 925 7211 30
>
>
>
> The information contained in this email message may be privileged,
> confidential and protected from disclosure. If you are not the intended
> recipient, any dissemination, distribution or copying is strictly
> prohibited. If you think that you have received this email message in
> error, please email the sender at info at ptfs-europe.com
>
>
>
>
>
>
>
> On Fri, 27 Sep 2019 at 17:42, Tomas Cohen Arazi <tomascohen at gmail.com>
> wrote:
>
> Hi all, I've been looking at the 'Claims returned' work (awesome!) [1] and
> I've noticed a pattern we should, in my opinion, start avoiding and
> reverting.
>
>
>
> It is quite common to find uses of C4::Context->userenv in the Koha::*
> namespace, either as a plain requirement (if the borrowernumber is not set
> we bail out) or just as a fallback. I think it is wrong to expect such
> environment status in our logic. It complicates things in various ways. [2]
>
>
>
> It is done this way because:
>
> - We come from the CGI era, in which it made perfect sense
>
> - Cookie auth is well established on the UI
>
> - When migrating from C4:* into Koha:* it is easier to just keep the
> current behavior and then evolve.
>
>
>
> I propose we leave them out, and add as a parameter whatever we are
> expecting to find in the userenv hashref. That way we could use this new
> libs in the API (which is not cookie-only).
>
>
>
> Looking forward to hear your opinions
>
>
>
> [1] https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14697
>
> [2] CLI scripts are using Koha::* libraries, and we then need to 'emulate'
> that userenv or even add code to detect we don't have a userenv.
>
>
>
> --
>
> Tomás Cohen Arazi
>
> Theke Solutions (http://theke.io)
> ✆ +54 9351 3513384
> GPG: B2F3C15F
>
> _______________________________________________
> Koha-devel mailing list
> Koha-devel at lists.koha-community.org
> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
> website : http://www.koha-community.org/
> git : http://git.koha-community.org/
> bugs : http://bugs.koha-community.org/
>
> _______________________________________________
> Koha-devel mailing list
> Koha-devel at lists.koha-community.org
> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
> website : http://www.koha-community.org/
> git : http://git.koha-community.org/
> bugs : http://bugs.koha-community.org/
>


-- 
Michael Hafen
Washington County School District Technology Department
Systems Analyst
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20190930/1e006185/attachment.html>


More information about the Koha-devel mailing list