From 86373fd3b4ab6541b491fdce39a3904b1bd7b40a Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Wed, 1 Nov 2023 18:43:53 -0600 Subject: [PATCH] Update permission for device profiles. Use device_profile_view, device_profile_select and device_profile_edit --- app/devices/device_edit.php | 68 +++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 30 deletions(-) diff --git a/app/devices/device_edit.php b/app/devices/device_edit.php index 7f028f9d2f..bea2a95060 100644 --- a/app/devices/device_edit.php +++ b/app/devices/device_edit.php @@ -1406,36 +1406,44 @@ echo " "; } - if (permission_exists('device_profile_edit')) { - //device profile - $sql = "select * from v_device_profiles "; - $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; - $sql .= "order by device_profile_name asc "; - $parameters['domain_uuid'] = $domain_uuid; - $database = new database; - $result = $database->select($sql, $parameters, 'all'); - if (is_array($result) && @sizeof($result) != 0) { - if (permission_exists('device_profile_select')) { - echo " "; - echo " ".$text['label-profile'].""; - echo " "; - echo " \n"; - } - if (permission_exists('device_profile_select_edit')) { - echo ""; - echo " "; - echo "
".$text['description-profile2']."\n"; - } - echo " "; - echo " "; - } - unset($sql, $parameters, $result); - } + if (permission_exists('device_profile_view')) { + + //device profiles + $sql = "select * from v_device_profiles "; + $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; + $sql .= "order by device_profile_name asc "; + $parameters['domain_uuid'] = $domain_uuid; + $database = new database; + $device_profiles = $database->select($sql, $parameters, 'all'); + if (is_array($device_profiles) && @sizeof($device_profiles) != 0) { + echo " "; + echo " ".$text['label-profile'].""; + echo " "; + if (permission_exists('device_profile_select')) { + echo " \n"; + } + else { + foreach($device_profiles as $row) { + if ($row['device_profile_uuid'] == $device_profile_uuid) { + echo escape($row['device_profile_name']); + } + } + } + if (permission_exists('device_profile_edit')) { + echo " "; + echo " "; + } + echo "
".$text['description-profile2']."\n"; + echo " "; + echo " "; + } + unset($sql, $parameters, $device_profiles); + } if (permission_exists('device_key_edit')) {