[Koha-bugs] [Bug 26383] Koha::Patron->is_superlibrarian is not optimal

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Jun 24 01:37:30 CEST 2021


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26383

--- Comment #4 from David Cook <dcook at prosentient.com.au> ---
Comment on attachment 122341
  --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=122341
Bug 26383: WIP Replace C4::Context->IsSuperLibrarian with
Koha::Patron->is_superlibrarian

Review of attachment 122341:
 --> (https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=26383&attachment=122341)
-----------------------------------------------------------------

::: C4/Circulation.pm
@@ +1073,5 @@
> +
> +    my $userenv = C4::Context->userenv;
> +    if ( C4::Context->preference("IndependentBranches") && $userenv ) {
> +        my $logged_in_user = Koha::Patrons->find($userenv->{number});
> +        unless ( $logged_in_user->is_superlibrarian ) {

Technically, the session stores the flags value, so we could just do the
calculation off the session data. The only downside of doing that is that we
probably only set the flags session data at login time, so if someone's
permissions change while they're logged in, it won't be detected until they've
logged out and logged back in. But... it would mean fewer database calls.

If we're doing a multi-checkout, the number of database calls would increase by
that factor...

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list