From d04fb8d17605d11dd37c40a0f75b15e4e2512b77 Mon Sep 17 00:00:00 2001 From: cigamit Date: Mon, 27 May 2019 11:02:20 -0500 Subject: [PATCH] Resolving Issue #2707 Some pages that have permission errors dont raise proper messages --- CHANGELOG | 1 + include/auth.php | 2 ++ include/layout.js | 10 +++++++++- lib/functions.php | 19 ++++++++++++++++++- permission_denied.php | 2 ++ 5 files changed, 32 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index d104f57e19..c3592a4495 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -39,6 +39,7 @@ Cacti CHANGELOG -issue#2698: Avoid duplicated icon in the main.js of all themes -issue#2699: Login Options: "Show the page that user pointed their browser to" Not Working -issue#2702: sqltable_to_php.php should ignore '--plugin' when '--update' +-issue#2707: Some pages that have permission errors dont raise proper messages -feature#2538: New global setting to change datasource behaviour when deleting graph -feature#2539: New global setting to add permanent unlock of graphs -feature#2540: New user setting to forget graph tree history on tab close diff --git a/include/auth.php b/include/auth.php index 34d98f031e..492a1b807d 100644 --- a/include/auth.php +++ b/include/auth.php @@ -260,6 +260,8 @@ $goBack = "[" . __('Login Again') . "]"; } + raise_ajax_permission_denied(); + $title_header = __('Permission Denied'); $title_body = '

' . __('You are not permitted to access this section of Cacti.') . '

' . __('If you feel that this is an error. Please contact your Cacti Administrator.'); diff --git a/include/layout.js b/include/layout.js index 33011a8db2..6b200fc50c 100644 --- a/include/layout.js +++ b/include/layout.js @@ -1830,7 +1830,7 @@ function setNavigationScroll() { $(object).css('overflow-y', 'auto'); }, 500); } - + isHover = true; } } @@ -1927,6 +1927,7 @@ function getPresentHTTPError(data) { var errorStr = data.status; var errorSub = data.statusText; var errorText = errorReasonUnexpected; + var found = false; if (typeof data.responseText != 'undefined') { var dataText = data.responseText; @@ -1937,14 +1938,21 @@ function getPresentHTTPError(data) { if (title_match != null) { var errorSub = title_match[1]; + found = true; } if (head_match != null) { var errorSub = head_match[1]; + found = true; } if (para_match != null) { var errorText = para_match[1]; + found = true; + } + + if (!found && dataText != '') { + var errorText = dataText; } var returnStr = '