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::Reserves;
use C4::Auth qw( get_template_and_user );
use C4::Auth qw( checkauth );
use C4::CourseReserves qw( DelCourse ModCourse ModCourseInstructors );
my $cgi = CGI->new;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{ template_name => "about.tt",
query => $cgi,
type => "intranet",
flagsrequired => { coursereserves => 'manage_courses' },
}
);
checkauth($cgi, 0, { coursereserves => 'manage_courses' }, 'intranet');
my $action = $cgi->param('action') || '';
my $course_id = $cgi->param('course_id');

View file

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

View file

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

View file

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