From 3b0874db497260a714dd731c51377abd0ba5323b Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 29 May 2017 21:39:58 -0400 Subject: [PATCH] Add nav menu element for custom nav elements and security value --- api/BusinessLogic/Security/UserContext.php | 6 +++++- inc/common.inc.php | 1 + inc/show_admin_nav.inc.php | 15 +++++++++++++++ language/en/text.php | 2 ++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/api/BusinessLogic/Security/UserContext.php b/api/BusinessLogic/Security/UserContext.php index dd6cebd4..0beedc07 100644 --- a/api/BusinessLogic/Security/UserContext.php +++ b/api/BusinessLogic/Security/UserContext.php @@ -69,7 +69,11 @@ class UserContext { $userContext->email = $dataRow['email']; $userContext->signature = $dataRow['signature']; $userContext->language = $dataRow['language']; - $userContext->categories = explode(',', $dataRow['categories']); + if (is_array($dataRow['categories'])) { + $userContext->categories = $dataRow['categories']; + } else { + $userContext->categories = explode(',', $dataRow['categories']); + } $userContext->permissions = explode(',', $dataRow['heskprivileges']); $userContext->autoAssign = boolval($dataRow['autoassign']); $userContext->ratingNegative = intval($dataRow['ratingneg']); diff --git a/inc/common.inc.php b/inc/common.inc.php index c4a7d237..d2eadaca 100644 --- a/inc/common.inc.php +++ b/inc/common.inc.php @@ -2032,6 +2032,7 @@ function hesk_getFeatureArray() 'can_change_notification_settings', /* User can change notification settings */ 'can_view_logs', /* User can view the message logs */ 'can_man_calendar', /* User can manage calendar events */ + 'can_man_custom_nav', /* User can manage custom nav elements */ ); } diff --git a/inc/show_admin_nav.inc.php b/inc/show_admin_nav.inc.php index f26f1beb..e4e140cc 100644 --- a/inc/show_admin_nav.inc.php +++ b/inc/show_admin_nav.inc.php @@ -438,6 +438,21 @@ $mails = mfh_get_mail_headers_for_dropdown($_SESSION['id'], $hesk_settings, $hes '; } + if (hesk_checkPermission('can_man_custom_nav', 0)) { + $number_of_settings++; + $active = ''; + if (defined('PAGE_TITLE') && PAGE_TITLE == 'ADMIN_CUSTOM_NAV_ELEMENTS') { + $active = 'active'; + } + + $markup .= ' +
  • + + + ' . $hesklang['manage_custom_nav_elements'] . ' + +
  • '; + } if ($number_of_settings > 0 && (hesk_checkPermission('can_view_logs', 0) || hesk_checkPermission('can_man_settings', 0))) { $markup .= '
  • '; diff --git a/language/en/text.php b/language/en/text.php index 2ab4608c..ab5ae57e 100644 --- a/language/en/text.php +++ b/language/en/text.php @@ -2125,6 +2125,8 @@ $hesklang['url_help'] = 'The URL where the user should be taken to. Both relativ $hesklang['common_properties'] = 'Common Properties'; $hesklang['customer_view'] = 'Customer View'; $hesklang['admin_panel'] = 'Admin Panel'; +$hesklang['manage_custom_nav_elements'] = 'Manage Custom Nav Elements'; +$hesklang['can_man_custom_nav'] = 'Can manage custom nav elements'; // DO NOT CHANGE BELOW if (!defined('IN_SCRIPT')) die('PHP syntax OK!');