Bug 30624: (QA follow-up) Use C4:Context to get permissions

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Lucas Gass 2023-02-28 17:04:52 +00:00 committed by Tomas Cohen Arazi
parent 1b6cd0c703
commit 28b629b502
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
2 changed files with 3 additions and 3 deletions

View File

@ -22,7 +22,7 @@ use CGI qw ( -utf8 );
use C4::Context;
use C4::Output qw( output_html_with_http_headers );
use C4::Auth qw( get_template_and_user get_session );
use C4::Auth qw( get_template_and_user get_session haspermission );
use Koha::BiblioFrameworks;
use Koha::Cash::Registers;
use Koha::Libraries;
@ -49,7 +49,7 @@ my $userenv_register_id = C4::Context->userenv->{'register_id'} || '';
my @updated;
# $session lines here are doing the updating
if ( $branch and my $library = Koha::Libraries->find($branch) and ( $flags->{loggedinlibrary} == 1 or $flags->{superlibrarian} == 1 ) ) {
if ( $branch and my $library = Koha::Libraries->find($branch) and ( C4::Auth::haspermission(C4::Context->userenv->{'id'}, { 'loggedinlibrary' => 1 }) or C4::Context::IsSuperLibraian() ) ) {
if ( !$userenv_branch or $userenv_branch ne $branch ) {
my $branchname = $library->branchname;
$session->param('branchname', $branchname); # update sesssion in DB

View File

@ -90,7 +90,7 @@ Updated:<ul>
<ol>
<li><label for="branch">Choose library:</label>
<select name="branch" id="branch">
[% PROCESS options_for_libraries libraries => Branches.all( selected => branch ) %]
[% PROCESS options_for_libraries libraries => Branches.all( selected => branch, unfiltered => 1 ) %]
</select></li>
</ol>
</fieldset>