Bug 31893: Use checkauth and do not fetch about.tt template

This patch updates four scripts to use checkauth instead of get_template_and_user

reserve/modrequest.pl
reserve/modrequest_suspendall.pl
course_reserves/mod_course.pl
members/members-update-do.pl

No behvaiour change is expected

To test:
0 - Apply patch
1 - Place some holds for a patron
2 - From patron page, confirm you can suspend all
3 - confirm you can delete marked holds
4 - Edit a course in course-reserves
5 - Make a chaneg to personal details via OPAC
6 - Confirm change can be approved on staff side

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit fc650b3e87)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
This commit is contained in:
Nick Clemens 2023-01-13 17:29:22 +00:00 committed by Matt Blenkinsop
parent 7a143c19ad
commit c1a5442a22
4 changed files with 12 additions and 37 deletions

View file

@ -23,18 +23,13 @@ use CGI qw ( -utf8 );
use C4::Output; use C4::Output;
use C4::Reserves; use C4::Reserves;
use C4::Auth qw( get_template_and_user ); use C4::Auth qw( checkauth );
use C4::CourseReserves qw( DelCourse ModCourse ModCourseInstructors ); use C4::CourseReserves qw( DelCourse ModCourse ModCourseInstructors );
my $cgi = CGI->new; my $cgi = CGI->new;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{ template_name => "about.tt", checkauth($cgi, 0, { coursereserves => 'manage_courses' }, 'intranet');
query => $cgi,
type => "intranet",
flagsrequired => { coursereserves => 'manage_courses' },
}
);
my $action = $cgi->param('action') || ''; my $action = $cgi->param('action') || '';
my $course_id = $cgi->param('course_id'); my $course_id = $cgi->param('course_id');

View file

@ -19,7 +19,7 @@
use Modern::Perl; use Modern::Perl;
use CGI qw ( -utf8 ); use CGI qw ( -utf8 );
use C4::Auth qw( get_template_and_user ); use C4::Auth qw( checkauth );
use C4::Output; use C4::Output;
use C4::Context; use C4::Context;
use Koha::Patrons; use Koha::Patrons;
@ -27,17 +27,9 @@ use Koha::Patron::Modifications;
my $query = CGI->new; my $query = CGI->new;
# FIXME Should be a checkauth call my ( $userid, $cookie, $sessionID, $flags ) = checkauth($query, 0, { borrowers => 'edit_borrowers' }, 'intranet');
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
template_name => "about.tt",
query => $query,
type => "intranet",
flagsrequired => { borrowers => 'edit_borrowers' },
}
);
my $logged_in_user = Koha::Patrons->find( $loggedinuser ); my $logged_in_user = Koha::Patrons->find({ userid => $userid });
my @params = $query->param; my @params = $query->param;

View file

@ -30,18 +30,12 @@ use Try::Tiny;
use C4::Output; use C4::Output;
use C4::Reserves qw( ModReserve ModReserveCancelAll ); use C4::Reserves qw( ModReserve ModReserveCancelAll );
use C4::Auth qw( get_template_and_user ); use C4::Auth qw( checkauth );
use Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue; use Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue;
my $query = CGI->new; my $query = CGI->new;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{ checkauth($query, 0, { reserveforothers => '*' }, 'intranet');
template_name => "about.tt",
query => $query,
type => "intranet",
flagsrequired => { reserveforothers => '*' },
}
);
my @reserve_id = $query->multi_param('reserve_id'); my @reserve_id = $query->multi_param('reserve_id');
my @rank = $query->multi_param('rank-request'); my @rank = $query->multi_param('rank-request');

View file

@ -26,17 +26,11 @@ use Modern::Perl;
use CGI qw ( -utf8 ); use CGI qw ( -utf8 );
use C4::Output; use C4::Output;
use C4::Reserves qw( SuspendAll ); use C4::Reserves qw( SuspendAll );
use C4::Auth qw( get_template_and_user ); use C4::Auth qw( checkauth );
my $query = CGI->new; my $query = CGI->new;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{ checkauth($query, 0, { reserveforothers => '*' }, 'intranet');
template_name => "about.tt",
query => $query,
type => "intranet",
flagsrequired => { reserveforothers => 1 },
}
);
my $borrowernumber = $query->param('borrowernumber'); my $borrowernumber = $query->param('borrowernumber');
my $suspend = $query->param('suspend'); my $suspend = $query->param('suspend');