diff --git a/app/devices/app_config.php b/app/devices/app_config.php index 446c313cf5..7eb68bed97 100644 --- a/app/devices/app_config.php +++ b/app/devices/app_config.php @@ -99,6 +99,22 @@ $apps[$x]['permissions'][$y]['name'] = "device_setting_delete"; $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; $y++; + $apps[$x]['permissions'][$y]['name'] = 'device_key_view'; + $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; + $apps[$x]['permissions'][$y]['groups'][] = 'admin'; + $y++; + $apps[$x]['permissions'][$y]['name'] = 'device_key_add'; + $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; + $apps[$x]['permissions'][$y]['groups'][] = 'admin'; + $y++; + $apps[$x]['permissions'][$y]['name'] = 'device_key_edit'; + $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; + $apps[$x]['permissions'][$y]['groups'][] = 'admin'; + $y++; + $apps[$x]['permissions'][$y]['name'] = 'device_key_delete'; + $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; + $apps[$x]['permissions'][$y]['groups'][] = 'admin'; + $y++; //schema details $y = 0; //table array index @@ -191,47 +207,6 @@ $y = 1; //table array index $z = 0; //field array index - $apps[$x]['db'][$y]['table'] = "v_device_extensions"; - $apps[$x]['db'][$y]['fields'][$z]['name'] = "device_extension_uuid"; - $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid"; - $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; - $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; - $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "primary"; - $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; - $z++; - $apps[$x]['db'][$y]['fields'][$z]['name'] = "domain_uuid"; - $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid"; - $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; - $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; - $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign"; - $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_domains"; - $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "domain_uuid"; - $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; - $z++; - $apps[$x]['db'][$y]['fields'][$z]['name'] = "device_uuid"; - $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid"; - $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; - $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; - $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign"; - $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_devices"; - $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "device_uuid"; - $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; - $z++; - $apps[$x]['db'][$y]['fields'][$z]['name'] = "extension_uuid"; - $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid"; - $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; - $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; - $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign"; - $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_extensions"; - $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "extension_uuid"; - $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; - $z++; - $apps[$x]['db'][$y]['fields'][$z]['name'] = "device_line"; - $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; - $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; - - $y = 2; //table array index - $z = 0; //field array index $apps[$x]['db'][$y]['table'] = "v_device_lines"; $apps[$x]['db'][$y]['fields'][$z]['name'] = "domain_uuid"; $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid"; @@ -283,8 +258,20 @@ $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the password."; $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "sip_port"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric"; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "sip_transport"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "register_expires"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric"; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; + $z++; - $y = 3; //table array index + $y = 2; //table array index $z = 0; //field array index $apps[$x]['db'][$y]['table'] = "v_device_settings"; $apps[$x]['db'][$y]['fields'][$z]['name'] = "device_setting_uuid"; @@ -336,4 +323,47 @@ $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; + + $y = 3; //table array index + $z = 0; //field array index + $apps[$x]['db'][$y]['table'] = 'v_device_keys'; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid'; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid'; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)'; + $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign'; + $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains'; + $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid'; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'device_key_uuid'; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid'; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)'; + $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary'; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'device_uuid'; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid'; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)'; + $apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign'; + $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_devices'; + $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'device_uuid'; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'device_key_id'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Select the key ID.'; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'device_key_type'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Select the type.'; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'device_key_value'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the value.'; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = 'device_key_label'; + $apps[$x]['db'][$y]['fields'][$z]['type'] = 'text'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the label.'; + $z++; + ?> diff --git a/app/devices/app_languages.php b/app/devices/app_languages.php index 309bf764c4..5f5c04f2ef 100644 --- a/app/devices/app_languages.php +++ b/app/devices/app_languages.php @@ -121,6 +121,30 @@ $text['description-outbound_proxy']['pt-pt'] = "Introduza o outbound proxy."; $text['description-outbound_proxy']['fr-fr'] = ""; + $text['label-sip_port']['en-us'] = "Port"; + $text['label-sip_port']['pt-pt'] = ""; + $text['label-sip_port']['fr-fr'] = ""; + + $text['description-sip_port']['en-us'] = "Enter the SIP port."; + $text['description-sip_port']['pt-pt'] = ""; + $text['description-sip_port']['fr-fr'] = ""; + + $text['label-sip_transport']['en-us'] = "Transport"; + $text['label-sip_transport']['pt-pt'] = ""; + $text['label-sip_transport']['fr-fr'] = ""; + + $text['description-sip_transport']['en-us'] = "Enter the SIP transport protocol."; + $text['description-sip_transport']['pt-pt'] = "Introduza o ."; + $text['description-sip_transport']['fr-fr'] = ""; + + $text['label-register_expires']['en-us'] = "Register Expires"; + $text['label-register_expires']['pt-pt'] = ""; + $text['label-register_expires']['fr-fr'] = ""; + + $text['description-register_expires']['en-us'] = "Enter the expire time for the SIP registration."; + $text['description-register_expires']['pt-pt'] = "."; + $text['description-register_expires']['fr-fr'] = ""; + $text['label-display_name']['en-us'] = "Display Name"; $text['label-display_name']['pt-pt'] = "Nome no visor"; $text['label-display_name']['fr-fr'] = "Nom affiché"; @@ -185,6 +209,53 @@ $text['description-device_description']['pt-pt'] = "Introduza a descrição."; $text['description-device_description']['fr-fr'] = ""; + //keys + $text['label-keys']['en-us'] = "Keys"; + $text['label-keys']['pt-pt'] = ""; + $text['label-keys']['fr-fr'] = ""; + + $text['title-device_keys']['en-us'] = 'Device Keys'; + $text['title-device_keys']['pt-pt'] = ''; + + $text['title-device_key']['en-us'] = 'Device Key'; + $text['title-device_key']['pt-pt'] = ''; + + $text['description-device_key']['en-us'] = ''; + $text['description-device_key']['pt-pt'] = ''; + + $text['label-device_key_id']['en-us'] = 'Key'; + $text['label-device_key_id']['pt-pt'] = ''; + + $text['description-device_key']['en-us'] = 'Select the key.'; + $text['description-device_key']['pt-pt'] = ''; + + $text['label-device_key_type']['en-us'] = 'Type'; + $text['label-device_key_type']['pt-pt'] = ''; + + $text['description-device_key_type']['en-us'] = 'Select the type of key.'; + $text['description-device_key_type']['pt-pt'] = ''; + + $text['label-device_key_value']['en-us'] = 'Value'; + $text['label-device_key_value']['pt-pt'] = ''; + + $text['description-device_key_value']['en-us'] = 'Enter the value.'; + $text['description-device_key_value']['pt-pt'] = ''; + + $text['label-device_key_label']['en-us'] = 'Label'; + $text['label-device_key_label']['pt-pt'] = ''; + + $text['description-device_key_label']['en-us'] = 'Enter the label.'; + $text['description-device_key_label']['pt-pt'] = ''; + + $text['label-line']['en-us'] = 'line'; + $text['label-line']['pt-pt'] = ''; + + $text['label-blf']['en-us'] = 'blf'; + $text['label-blf']['pt-pt'] = ''; + + $text['label-park']['en-us'] = 'park'; + $text['label-park']['pt-pt'] = ''; + //general translations $text['label-true']['en-us'] = "true"; $text['label-true']['pt-pt'] = "sim"; diff --git a/app/devices/device_edit.php b/app/devices/device_edit.php index f82cb2b498..801479016f 100644 --- a/app/devices/device_edit.php +++ b/app/devices/device_edit.php @@ -74,6 +74,11 @@ require_once "resources/require.php"; $user_id = check_str($_POST["user_id"]); $auth_id = check_str($_POST["auth_id"]); $password = check_str($_POST["password"]); + //keys + $device_key_id = check_str($_POST["device_key_id"]); + $device_key_type = check_str($_POST["device_key_type"]); + $device_key_value = check_str($_POST["device_key_value"]); + $device_key_label = check_str($_POST["device_key_label"]); //settings //$device_setting_category = check_str($_POST["device_setting_category"]); $device_setting_subcategory = check_str($_POST["device_setting_subcategory"]); @@ -245,7 +250,33 @@ require_once "resources/require.php"; unset($sql); } - //add the device settings + //add a device key + if (strlen($device_key_id) > 0 && permission_exists('device_key_add')) { + $sql = "insert into v_device_keys "; + $sql .= "("; + $sql .= "domain_uuid, "; + $sql .= "device_uuid, "; + $sql .= "device_key_uuid, "; + $sql .= "device_key_id, "; + $sql .= "device_key_type, "; + $sql .= "device_key_value, "; + $sql .= "device_key_label "; + $sql .= ")"; + $sql .= " values "; + $sql .= "("; + $sql .= "'$domain_uuid', "; + $sql .= "'$device_uuid', "; + $sql .= "'".uuid()."', "; + $sql .= "'$device_key_id', "; + $sql .= "'$device_key_type', "; + $sql .= "'$device_key_value', "; + $sql .= "'$device_key_label' "; + $sql .= ")"; + $db->exec(check_sql($sql)); + unset($sql); + } + + //add a device setting if (strlen($device_setting_subcategory) > 0 && permission_exists('device_setting_add')) { $device_setting_category = "provision"; $device_setting_name = "text"; @@ -451,7 +482,7 @@ require_once "resources/require.php"; echo " ".$row['auth_id']." \n"; echo " \n"; echo "
| ".$text['label-device_key_id']." | \n"; + echo "".$text['label-device_key_type']." | \n"; + echo "".$text['label-device_key_value']." | \n"; + echo "".$text['label-device_key_label']." | \n"; + echo "\n"; + echo " |
| \n"; + echo " ".$row['device_key_id']." \n"; + echo " | \n"; + echo "\n"; + echo " ".$row['device_key_type']." \n"; + echo " | \n"; + echo "\n"; + echo " ".$row['device_key_value']." \n"; + echo " | \n"; + echo "\n"; + echo " ".$row['device_key_label']." \n"; + echo " | \n"; + echo "\n"; + if (permission_exists('device_key_edit')) { + echo " $v_link_label_edit\n"; + } + if (permission_exists('device_key_delete')) { + echo " $v_link_label_delete\n"; + } + echo " | \n"; + echo "
| \n"; + echo " \n"; + echo " | \n"; + + echo "\n"; + echo " \n"; + echo " | \n"; + + echo "\n"; + echo " \n"; + echo " | \n"; + + echo "\n"; + echo " \n"; + echo " | \n"; + + echo "\n"; + echo " \n"; + echo " | \n"; + echo "
| \n";
+ echo $msg." "; + echo " |
| \n";
+ echo " "; + + echo " | ";
+ echo "