From e0c82e02f1f37921e96e700f5390d2517f4722d3 Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Thu, 31 Oct 2019 00:17:25 +0000 Subject: [PATCH] Bug 23930: Implemented syspref where you can configure URL re-directed to whena patron with insufficient permissions tries to login to the staff client Sponsored-by: Waikato Institute of Technology, New Zealand --- C4/Auth.pm | 9 +++++++++ ...bug_23920_-_new_syspref_InsufficientPermissionRedirectURL.sql | 1 + ...bug_23920_-_new_syspref_InsufficientPermissionRedirectURL.sql | 1 + .../intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref | 4 +++- 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 installer/data/mysql/atomicupdate/bug_23920_-_new_syspref_InsufficientPermissionRedirectURL.sql create mode 100644 installer/data/mysql/bug_23920_-_new_syspref_InsufficientPermissionRedirectURL.sql diff --git a/C4/Auth.pm b/C4/Auth.pm index cbfccb14bf..8aa053fb39 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -903,6 +903,9 @@ sub checkauth { $info{'nopermission'} = 1; C4::Context->_unset_userenv($sessionID); $loggedin = 0; + if (C4::Context->preference('InsufficientPermissionRedirectURL')) { + print $query->redirect(C4::Context->preference('InsufficientPermissionRedirectURL')); + } } } elsif ( $emailaddress) { @@ -1011,6 +1014,9 @@ sub checkauth { $loggedin = 1; } else { $info{'nopermission'} = 1; + if (C4::Context->preference('InsufficientPermissionRedirectURL')) { + print $query->redirect(C4::Context->preference('InsufficientPermissionRedirectURL')); + } } } } @@ -1140,6 +1146,9 @@ sub checkauth { else { $info{'nopermission'} = 1; C4::Context->_unset_userenv($sessionID); + if (C4::Context->preference('InsufficientPermissionRedirectURL')) { + print $query->redirect(C4::Context->preference('InsufficientPermissionRedirectURL')); + } } my ( $borrowernumber, $firstname, $surname, $userflags, $branchcode, $branchname, $branchprinter, $emailaddress ); diff --git a/installer/data/mysql/atomicupdate/bug_23920_-_new_syspref_InsufficientPermissionRedirectURL.sql b/installer/data/mysql/atomicupdate/bug_23920_-_new_syspref_InsufficientPermissionRedirectURL.sql new file mode 100644 index 0000000000..aded75ab25 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_23920_-_new_syspref_InsufficientPermissionRedirectURL.sql @@ -0,0 +1 @@ +INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES ('InsufficientPermissionRedirectURL', NULL, NULL, 'URL Koha will redirect to when patrons with insufficient permissions try to login to staff client', 'Textarea'); diff --git a/installer/data/mysql/bug_23920_-_new_syspref_InsufficientPermissionRedirectURL.sql b/installer/data/mysql/bug_23920_-_new_syspref_InsufficientPermissionRedirectURL.sql new file mode 100644 index 0000000000..aa0d9615de --- /dev/null +++ b/installer/data/mysql/bug_23920_-_new_syspref_InsufficientPermissionRedirectURL.sql @@ -0,0 +1 @@ +INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES ('InsufficientPermissionRedirectURL', NULL, NULL, 'URL that koha will re-direct to after a patron with insufficient permissions tries logging into the staff client', 'Textarea'); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref index 9007da96a4..aa38abdc50 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -227,7 +227,9 @@ Patrons: no: Allow all permitted users - "to access/change superlibrarian privileges." - "
NOTE: A permitted user needs to have the 'permissions' flag (if no superlibrarian)." - + - + - pref: InsufficientPermissionRedirectURL + - Enter a URL which Koha will re-direct to if a patron with insufficient permissions tries to login the staff client Privacy: - - Use the following URL -- 2.11.0