Bug 20649 - C4::Auth should use C4::Context->IsSuperLibrarian()
Summary: C4::Auth should use C4::Context->IsSuperLibrarian()
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Authentication (show other bugs)
Version: master
Hardware: All All
: P5 - low minor (vote)
Assignee: Bugs List
QA Contact: Testopia
Depends on: 20479
  Show dependency treegraph
Reported: 2018-04-24 11:19 UTC by Katrin Fischer
Modified: 2019-03-04 18:47 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Text to go in the release notes:
Version(s) released in:


Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2018-04-24 11:19:38 UTC
We had a lot of trouble with superlibrarian checks in the past, which is why we introduced C4::Context->IsSuperLibrarian(). C4::Auth should use it instead of:

06             && $flags && $flags->{superlibrarian} != 1

Comment 1 Katrin Fischer 2018-04-24 11:36:13 UTC
Probably here too, noting that on bug 20515:

 297         if ( $flags && $flags->{superlibrarian} == 1 ) {
 298             $template->param( CAN_user_circulate        => 1 );
Comment 2 Jonathan Druart 2018-04-24 13:47:54 UTC
No, C4::Context->IsSuperlibrarian tells if the logged in user has the superlibrarian flags.
In C4::Auth::get_template_and_user the user is not logged in yet.
Comment 3 Jonathan Druart 2018-04-24 13:56:17 UTC
Actually yes, userenv is set in checkauth which has been called few lines above.
Comment 4 Katrin Fischer 2019-02-10 13:15:37 UTC
Sorry, Jonathan, I don't understand yet. Maybe we can take a look at it together sometime?
Comment 5 Jonathan Druart 2019-03-04 18:47:25 UTC
(In reply to Katrin Fischer from comment #4)
> Sorry, Jonathan, I don't understand yet. Maybe we can take a look at it
> together sometime?

Scratch comment 2, we could replace it instead.