From 28b629b502d2ea0c617c3051dc7091d016a720a2 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Tue, 28 Feb 2023 17:04:52 +0000 Subject: [PATCH] Bug 30624: (QA follow-up) Use C4:Context to get permissions Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- circ/set-library.pl | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/modules/circ/set-library.tt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/circ/set-library.pl b/circ/set-library.pl index 35261a5006..06b171c75b 100755 --- a/circ/set-library.pl +++ b/circ/set-library.pl @@ -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 diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/set-library.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/set-library.tt index 08f7397df0..9c50675708 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/set-library.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/set-library.tt @@ -90,7 +90,7 @@ Updated:
    -- 2.39.5