From 1bc18818fe4039ac4f880eec73caac9fadc6bba9 Mon Sep 17 00:00:00 2001 From: Oliver Goldschmidt <o.goldschmidt@tu-harburg.de> Date: Wed, 30 Aug 2017 14:02:21 -0400 Subject: [PATCH] Added "permission denied" page. --- languages/de.ini | 2 ++ languages/en.ini | 2 ++ module/VuFind/config/module.config.php | 3 ++- .../src/VuFind/Controller/ErrorController.php | 14 +++++++++++ .../templates/error/permissiondenied.phtml | 25 +++++++++++++++++++ 5 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 themes/bootstrap3/templates/error/permissiondenied.phtml diff --git a/languages/de.ini b/languages/de.ini index 4b021e61d6b..8db55d38f43 100644 --- a/languages/de.ini +++ b/languages/de.ini @@ -730,6 +730,8 @@ past_days = "seit %%range%% Tagen" PDF Full Text = "PDF-Volltext" peer_reviewed = "Peer Reviewed" peer_reviewed_limit = "Auf Artikel aus peer-reviewed Zeitschriften einschränken" +permission_denied = "Sie haben keinen Zugriff auf die angeforderte Seite oder Aktion." +permission_denied_title = "Zugriff verweigert" Phone Number = "Telefon" Photo = "Foto" Physical Description = "Beschreibung" diff --git a/languages/en.ini b/languages/en.ini index 7761bc11bcb..377ac6bb34c 100644 --- a/languages/en.ini +++ b/languages/en.ini @@ -733,6 +733,8 @@ past_days = "Past %%range%% Days" PDF Full Text = "PDF Full Text" peer_reviewed = "Peer Reviewed" peer_reviewed_limit = "Limit to articles from peer-reviewed journals" +permission_denied = "You have requested a page or action, but you do not have the necessary permission." +permission_denied_title = "Permission denied" Phone Number = "Phone Number" Photo = "Photo" Physical Description = "Physical Description" diff --git a/module/VuFind/config/module.config.php b/module/VuFind/config/module.config.php index 77cebd0da92..314f7c9631a 100644 --- a/module/VuFind/config/module.config.php +++ b/module/VuFind/config/module.config.php @@ -828,7 +828,8 @@ $staticRoutes = [ 'Confirm/Confirm', 'Cover/Show', 'Cover/Unavailable', 'EDS/Advanced', 'EDS/Home', 'EDS/Search', 'EIT/Advanced', 'EIT/Home', 'EIT/Search', - 'Error/Unavailable', 'Feedback/Email', 'Feedback/Home', 'Help/Home', + 'Error/PermissionDenied', 'Error/Unavailable', + 'Feedback/Email', 'Feedback/Home', 'Help/Home', 'Install/Done', 'Install/FixBasicConfig', 'Install/FixCache', 'Install/FixDatabase', 'Install/FixDependencies', 'Install/FixILS', 'Install/FixSecurity', 'Install/FixSolr', 'Install/FixSSLCerts', 'Install/Home', diff --git a/module/VuFind/src/VuFind/Controller/ErrorController.php b/module/VuFind/src/VuFind/Controller/ErrorController.php index 57ceb4120fe..2255beed4bd 100644 --- a/module/VuFind/src/VuFind/Controller/ErrorController.php +++ b/module/VuFind/src/VuFind/Controller/ErrorController.php @@ -50,4 +50,18 @@ class ErrorController extends AbstractActionController $this->getResponse()->setStatusCode(503); return new \Zend\View\Model\ViewModel(); } + + /** + * Display permission denied message. + * + * @return mixed + */ + public function permissionDeniedAction() + { + $this->getResponse()->setStatusCode(403); + return new \Zend\View\Model\ViewModel( + ['msg' => $this->params()->fromQuery('msg')] + ); + } + } diff --git a/themes/bootstrap3/templates/error/permissiondenied.phtml b/themes/bootstrap3/templates/error/permissiondenied.phtml new file mode 100644 index 00000000000..344afc5be92 --- /dev/null +++ b/themes/bootstrap3/templates/error/permissiondenied.phtml @@ -0,0 +1,25 @@ +<? + // Set page title. + $this->headTitle($this->translate('permission_denied_title')); + + // Disable top search box -- this page has a special layout. + $this->layout()->searchbox = false; + + $this->layout()->breadcrumbs = '<li class="active">Error</li>'; +?> +<div> + <h2><?=$this->transEsc('permission_denied_title')?></h2> + <p><?=$this->flashmessages()?></p> + <p> + <?=$this->transEsc('permission_denied')?> + <? if (!empty($msg)): ?> + <div class="alert alert-danger"><?=$this->transEsc($msg)?></div> + <? endif; ?> + </p> + <p> + <?=$this->transEsc('Please contact the Library Reference Department for assistance')?> + <br/> + <? $supportEmail = $this->escapeHtmlAttr($this->systemEmail()); ?> + <a href="mailto:<?=$supportEmail?>"><?=$supportEmail?></a> + </p> +</div> -- GitLab