From 6000c8235c5b73e7fadade178e956a0840466d2c Mon Sep 17 00:00:00 2001 From: fusionate Date: Fri, 4 Aug 2023 19:28:08 +0000 Subject: [PATCH] Dashboard - Ring Group Forward: Remove form elements if ring_group_forward permission not assigned. --- .../dashboard/ring_group_forward.php | 65 +++++++++++++------ 1 file changed, 44 insertions(+), 21 deletions(-) diff --git a/app/ring_groups/resources/dashboard/ring_group_forward.php b/app/ring_groups/resources/dashboard/ring_group_forward.php index 0c3061a2ee..0c9bef19af 100644 --- a/app/ring_groups/resources/dashboard/ring_group_forward.php +++ b/app/ring_groups/resources/dashboard/ring_group_forward.php @@ -144,8 +144,10 @@ $row_style["1"] = "row_style1"; //create token - $object = new token; - $token = $object->create('/app/ring_groups/ring_group_forward.php'); + if (permission_exists('ring_group_forward')) { + $object = new token; + $token = $object->create('/app/ring_groups/ring_group_forward.php'); + } //ring group forward echo "
\n"; @@ -207,11 +209,13 @@ echo "\n"; //details - echo "
\n"; + if (permission_exists('ring_group_forward')) { + echo "\n"; + } echo "
"; - if (is_array($result) && @sizeof($result) != 0) { + if (is_array($result) && @sizeof($result) != 0 && permission_exists('ring_group_forward')) { echo button::create(['type'=>'button','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'collapse'=>false,'style'=>"position: absolute; margin-top: -35px; margin-left: -72px;",'onclick'=>"list_form_submit('form_list_ring_group_forward');"]); } @@ -231,25 +235,42 @@ echo "\n"; echo " ".escape($row['ring_group_name'])."\n"; echo " ".escape($row['ring_group_extension'])."\n"; - echo " "; - echo " "; - // switch - if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { - echo " \n"; + if (permission_exists('ring_group_forward')) { + echo " "; + echo " "; + // switch + if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { + echo " \n"; + } + // select + else { + echo " \n"; + } } - // select else { - echo " \n"; + echo " "; + if ($row["ring_group_forward_enabled"] == 'true') { + echo $text['option-enabled']; + } + else { + echo $text['option-disabled']; + } } echo " \n"; - echo " "; - echo " "; + if (permission_exists('ring_group_forward')) { + echo " "; + echo " "; + } + else { + echo " "; + echo escape(format_phone($row["ring_group_forward_destination"] ?? '')); + } echo " \n"; echo "\n"; $x++; @@ -262,8 +283,10 @@ echo "
"; //$n++; - echo "\n"; - echo "
\n"; + if (permission_exists('ring_group_forward')) { + echo "\n"; + echo "\n"; + } echo ""; echo "
\n";