<div dir="ltr">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.<div><br></div><div>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]</div><div><br></div><div>It is done this way because:</div><div>- We come from the CGI era, in which it made perfect sense</div><div>- Cookie auth is well established on the UI</div><div>- When migrating from C4:* into Koha:* it is easier to just keep the current behavior and then evolve.</div><div><br></div><div>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).</div><div><br></div><div>Looking forward to hear your opinions <br><div><br></div><div>[1] <a href="https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14697">https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14697</a></div><div>[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.<br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div style="font-size:12.8px">Tomás Cohen Arazi</div><div style="font-size:12.8px">Theke Solutions (<a href="http://theke.io/" target="_blank">http://theke.io</a>)<br>✆ +54 9351 3513384<br>GPG: B2F3C15F</div></div></div></div></div></div></div></div>