From 94eab98ab3635c5d971e677f82f0a860220c63f4 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Tue, 25 Jan 2022 09:53:03 -0700 Subject: [PATCH] Add device_key_icon permission (#6262) * Add device_key_icon permission * Use the new device_key_icon permission. * Use the device_key_icon permission --- app/devices/app_config.php | 14 ++---------- app/devices/device_edit.php | 22 +++++++++++++------ .../resources/dashboard/device_keys.php | 22 +++++++++++++------ 3 files changed, 32 insertions(+), 26 deletions(-) diff --git a/app/devices/app_config.php b/app/devices/app_config.php index 0c6e43ae2d..e559fd3a43 100644 --- a/app/devices/app_config.php +++ b/app/devices/app_config.php @@ -268,19 +268,15 @@ $y++; $apps[$x]['permissions'][$y]['name'] = 'device_profile_view'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; - //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'device_profile_add'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; - //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'device_profile_edit'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; - //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'device_profile_delete'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; - //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'device_profile_all'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; @@ -290,38 +286,30 @@ $y++; $apps[$x]['permissions'][$y]['name'] = 'device_profile_key_view'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; - //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'device_profile_key_add'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; - //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'device_profile_key_edit'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; - //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'device_profile_key_delete'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; - //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'device_profile_key_all'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'device_profile_setting_view'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; - //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'device_profile_setting_add'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; - //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'device_profile_setting_edit'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; - //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'device_profile_setting_delete'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; - //$apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; $apps[$x]['permissions'][$y]['name'] = 'device_profile_setting_all'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; @@ -329,6 +317,8 @@ $apps[$x]['permissions'][$y]['name'] = 'device_export'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; $y++; + $apps[$x]['permissions'][$y]['name'] = 'device_key_icon'; + $y++; //default settings $y = 0; diff --git a/app/devices/device_edit.php b/app/devices/device_edit.php index ad627395a9..9918c29818 100644 --- a/app/devices/device_edit.php +++ b/app/devices/device_edit.php @@ -391,7 +391,9 @@ } //$array['devices'][0]['device_keys'][$y]['device_key_protected'] = $row["device_key_protected"]; $array['devices'][0]['device_keys'][$y]['device_key_label'] = $row["device_key_label"]; - $array['devices'][0]['device_keys'][$y]['device_key_icon'] = $row["device_key_icon"]; + if (permission_exists('device_key_icon')) { + $array['devices'][0]['device_keys'][$y]['device_key_icon'] = $row["device_key_icon"]; + } $y++; } } @@ -1335,7 +1337,9 @@ echo " ".$text['label-device_key_extension']."\n"; } echo " ".$text['label-device_key_label']."\n"; - echo " ".$text['label-device_key_icon']."\n"; + if (permission_exists('device_key_icon')) { + echo " ".$text['label-device_key_icon']."\n"; + } if (is_array($device_keys) && @sizeof($device_keys) > 1 && permission_exists('device_key_delete')) { echo " \n"; echo " ".$text['label-delete']."\n"; @@ -1367,7 +1371,9 @@ echo " ".$text['label-device_key_extension']."\n"; } echo " ".$text['label-device_key_label']."\n"; - echo " ".$text['label-device_key_icon']."\n"; + if (permission_exists('device_key_icon')) { + echo " ".$text['label-device_key_icon']."\n"; + } if (is_array($device_keys) && @sizeof($device_keys) > 1 && permission_exists('device_key_delete')) { echo " \n"; echo " ".$text['label-delete']."\n"; @@ -1579,10 +1585,12 @@ echo "\n"; echo " \n"; echo "\n"; - - echo "\n"; - echo " \n"; - echo "\n"; + + if (permission_exists('device_key_icon')) { + echo "\n"; + echo " \n"; + echo "\n"; + } if (is_array($device_keys) && @sizeof($device_keys) > 1 && permission_exists('device_key_delete')) { if (is_uuid($row['device_key_uuid'])) { diff --git a/app/devices/resources/dashboard/device_keys.php b/app/devices/resources/dashboard/device_keys.php index 4155b4f9a1..6536fbdd84 100644 --- a/app/devices/resources/dashboard/device_keys.php +++ b/app/devices/resources/dashboard/device_keys.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2016-2021 + Portions created by the Initial Developer are Copyright (C) 2016-2022 the Initial Developer. All Rights Reserved. */ @@ -231,7 +231,9 @@ $array['device_keys'][0]['device_key_line'] = $device_key_line; $array['device_keys'][0]['device_key_value'] = $device_key_value; $array['device_keys'][0]['device_key_label'] = $device_key_label; - $array['device_keys'][0]['device_key_icon'] = $device_key_icon; + if (permission_exists('device_key_icon')) { + $array['device_keys'][0]['device_key_icon'] = $device_key_icon; + } $array['device_keys'][0]['device_key_category'] = $device_key_category; $array['device_keys'][0]['device_key_vendor'] = $device_key_vendor; @@ -252,7 +254,9 @@ $array['device_keys'][0]['device_key_type'] = $device_key_type; $array['device_keys'][0]['device_key_value'] = $device_key_value; $array['device_keys'][0]['device_key_label'] = $device_key_label; - $array['device_keys'][0]['device_key_icon'] = $device_key_icon; + if (permission_exists('device_key_icon')) { + $array['device_keys'][0]['device_key_icon'] = $device_key_icon; + } } if ($save) { //add the temporary permissions @@ -470,7 +474,9 @@ } echo " ".$text['label-device_key_value']."\n"; echo " ".$text['label-device_key_label']."\n"; - echo " ".$text['label-device_key_icon']."\n"; + if (permission_exists('device_key_icon')) { + echo " ".$text['label-device_key_icon']."\n"; + } echo " \n"; } @@ -610,11 +616,13 @@ echo " \n"; echo " \n"; echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; echo " \n"; echo " \n"; + if (permission_exists('device_key_icon')) { + echo " \n"; + echo " \n"; + echo " \n"; + } echo " \n"; //set the previous vendor