From fbb2af9bad6c944629e9dbeca897c171929c76ae Mon Sep 17 00:00:00 2001 From: K-Flagman <105959875+k-flagman@users.noreply.github.com> Date: Sat, 16 Dec 2023 10:15:22 -0800 Subject: [PATCH] Device address in extensions list (#6811) * Update app_config.php adding permissions for showing MAC address in the extension list * Update extensions.php Adding a new column with MAC address info if it exists for the extension. * Renamed the permission to access of extension address * Fixed fields where we used deprecated "device mac address" Also added support for "show all" button (load device list for current domain or get all devices) --- app/extensions/app_config.php | 7 ++++++- app/extensions/extensions.php | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/app/extensions/app_config.php b/app/extensions/app_config.php index 07e40a8470..8379d45a8f 100644 --- a/app/extensions/app_config.php +++ b/app/extensions/app_config.php @@ -237,6 +237,11 @@ $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; $apps[$x]['permissions'][$y]['groups'][] = "admin"; $apps[$x]['permissions'][$y]['groups'][] = "user"; + $y++; + $apps[$x]['permissions'][$y]['name'] = "extension_address"; + $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; + $apps[$x]['permissions'][$y]['groups'][] = "admin"; + $apps[$x]['permissions'][$y]['groups'][] = "user"; //default settings $y=0; @@ -741,4 +746,4 @@ $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; -?> \ No newline at end of file +?> diff --git a/app/extensions/extensions.php b/app/extensions/extensions.php index 487900545f..a0a0233283 100644 --- a/app/extensions/extensions.php +++ b/app/extensions/extensions.php @@ -254,6 +254,9 @@ if (permission_exists("extension_call_group")) { echo th_order_by('call_group', $text['label-call_group'], $order_by, $order); } + if (permission_exists("extension_address")) { + echo th_order_by('extension_address', $text['label-device_address'], $order_by, $order); + } if (permission_exists("extension_user_context")) { echo th_order_by('user_context', $text['label-user_context'], $order_by, $order); } @@ -268,6 +271,26 @@ echo "\n"; if (is_array($extensions) && @sizeof($extensions) != 0) { + if (permission_exists("extension_address")) { + // get all device list + $sql = " select l.user_id, l.domain_uuid, d.device_address, d.device_template, d.device_description, l.device_line_uuid, l.device_uuid, l.line_number "; + $sql .= " from v_device_lines as l, v_devices as d "; + $sql .= " where l.device_uuid = d.device_uuid "; + if (!($_GET['show'] == "all" && permission_exists('extension_all'))) { + $sql.= " and l.domain_uuid = :domain_uuid "; + } + $sql .= " order by l.line_number, d.device_address asc "; + if (!($_GET['show'] == "all" && permission_exists('extension_all'))) { + $parameters['domain_uuid'] = $_SESSION['domain_uuid']; + } + $database = new database; + if ($_GET['show'] == "all" && permission_exists('extension_all')) { + $device_lines = $database->select($sql, 'all'); + } else { + $device_lines = $database->select($sql, $parameters, 'all'); + } + unset($sql, $parameters, $database); + } $x = 0; foreach($extensions as $row) { if (permission_exists('extension_edit')) { @@ -299,6 +322,16 @@ if (permission_exists("extension_call_group")) { echo "