From cc885b1643bd0949d8cba472423659a6319301c7 Mon Sep 17 00:00:00 2001 From: Alex Sassmannshausen Date: Thu, 6 Jul 2017 17:35:41 +0200 Subject: [PATCH] Bug 18902: Disable access to CourseReserves if syspref off. * course_reserves/course-reserves.pl: Add syspref check. * course_reserves/mod_course.pl: Add syspref check. * opac/opac-course-reserves.pl: Add syspref check. Test Plan: - Before applying this patch: + Ensure UseCourseReserves is switched off + visit OPAC: cgi-bin/koha/opac-course-reserves.pl + visit Intranet: /cgi-bin/koha/course_reserves/course-reserves.pl + visit Intranet: /cgi-bin/koha/course_reserves/mod_course.pl + All will be accessible. - After applying this patch: + Ensure UseCourseReserves is switched off + visit OPAC: cgi-bin/koha/opac-course-reserves.pl + visit Intranet: /cgi-bin/koha/course_reserves/course-reserves.pl + visit Intranet: /cgi-bin/koha/course_reserves/mod_course.pl + None will be accessible. + Ensure UseCourseReserves is switched on + visit OPAC: cgi-bin/koha/opac-course-reserves.pl + visit Intranet: /cgi-bin/koha/course_reserves/course-reserves.pl + visit Intranet: /cgi-bin/koha/course_reserves/mod_course.pl + All will be accessible. --- course_reserves/course-reserves.pl | 6 ++++++ course_reserves/mod_course.pl | 7 +++++++ opac/opac-course-reserves.pl | 6 ++++++ 3 files changed, 19 insertions(+) diff --git a/course_reserves/course-reserves.pl b/course_reserves/course-reserves.pl index ca666969d4..5c203d7f0b 100755 --- a/course_reserves/course-reserves.pl +++ b/course_reserves/course-reserves.pl @@ -29,6 +29,12 @@ use C4::CourseReserves qw(GetCourses); my $cgi = new CGI; +unless (C4::Context->preference('UseCourseReserves')) { + # redirect to Intranet home if self-check is not enabled + print $cgi->redirect("/cgi-bin/koha/mainpage.pl"); + exit; +} + my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { template_name => "course_reserves/course-reserves.tt", diff --git a/course_reserves/mod_course.pl b/course_reserves/mod_course.pl index 844d157dd1..ac0c839aba 100755 --- a/course_reserves/mod_course.pl +++ b/course_reserves/mod_course.pl @@ -28,6 +28,13 @@ use C4::Auth; use C4::CourseReserves qw(DelCourse ModCourse ModCourseInstructors); my $cgi = new CGI; + +unless (C4::Context->preference('UseCourseReserves')) { + # redirect to Intranet home if self-check is not enabled + print $cgi->redirect("/cgi-bin/koha/mainpage.pl"); + exit; +} + my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { template_name => "about.tt", query => $cgi, diff --git a/opac/opac-course-reserves.pl b/opac/opac-course-reserves.pl index de1498b77f..51297a6594 100755 --- a/opac/opac-course-reserves.pl +++ b/opac/opac-course-reserves.pl @@ -29,6 +29,12 @@ use C4::CourseReserves qw(SearchCourses); my $cgi = new CGI; +unless (C4::Context->preference('UseCourseReserves')) { + # redirect to Intranet home if self-check is not enabled + print $cgi->redirect("/cgi-bin/koha/opac-main.pl"); + exit; +} + my ( $template, $borrowernumber, $cookie ) = get_template_and_user( { template_name => "opac-course-reserves.tt", query => $cgi, -- 2.13.2