From 0cc9a01a5ab8fa8e4df1caaec2f7dd4f59c247a8 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Fri, 20 May 2016 10:39:16 -0600 Subject: [PATCH] Add ability to assign a single user to a device. --- app/devices/app_config.php | 13 +++++++++++++ app/devices/app_languages.php | 21 +++++++++++++++++++++ app/devices/device_edit.php | 31 +++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+) diff --git a/app/devices/app_config.php b/app/devices/app_config.php index ac0d41b23b..2656f73791 100644 --- a/app/devices/app_config.php +++ b/app/devices/app_config.php @@ -123,6 +123,10 @@ $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; $apps[$x]['permissions'][$y]['groups'][] = 'admin'; $y++; + $apps[$x]['permissions'][$y]['name'] = 'device_username'; + $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; + $apps[$x]['permissions'][$y]['groups'][] = 'admin'; + $y++; $apps[$x]['permissions'][$y]['name'] = 'device_username_password'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; $apps[$x]['permissions'][$y]['groups'][] = 'admin'; @@ -250,6 +254,15 @@ $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'] = "user_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_users"; + $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "user_uuid"; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; + $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "device_username"; $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; diff --git a/app/devices/app_languages.php b/app/devices/app_languages.php index da0690d4eb..44582016dd 100644 --- a/app/devices/app_languages.php +++ b/app/devices/app_languages.php @@ -195,6 +195,17 @@ $text['label-voicemail']['de-at'] = "Sprachnachricht"; $text['label-voicemail']['ar-eg'] = "البريد الصوتي"; $text['label-voicemail']['he'] = "תיבה קולית"; +$text['label-users']['en-us'] = "Users"; +$text['label-users']['es-cl'] = "Usuarios"; +$text['label-users']['pt-pt'] = "Utilizadores"; +$text['label-users']['fr-fr'] = "Utilisateurs"; +$text['label-users']['pt-br'] = "Usuários"; +$text['label-users']['pl'] = "Użytkownicy"; +$text['label-users']['sv-se'] = "Användare"; +$text['label-users']['uk'] = "Користувачі"; +$text['label-users']['de-at'] = "Benutzer"; +$text['label-users']['he'] = ""; + $text['label-user_id']['en-us'] = "User ID"; $text['label-user_id']['es-cl'] = "ID de usuario"; $text['label-user_id']['pt-pt'] = "ID do utilizador"; @@ -1864,6 +1875,16 @@ $text['header-device']['de-at'] = "Gerät"; $text['header-device']['ar-eg'] = ""; $text['header-device']['he'] = "מכשיר"; +$text['description-users']['en-us'] = "Assign additional users as administrators of this conference room."; +$text['description-users']['es-cl'] = "Asignar usuarios adicionales como administradores de esta sala de conferencia."; +$text['description-users']['pt-pt'] = "Atribuir utilizadores adicionais como administradores da sala de conferência."; +$text['description-users']['fr-fr'] = "Ajouter des utilisateurs comme administrateurs des cette salle de conférence."; +$text['description-users']['pt-br'] = "Atribuir usuários adicionais como administradores da sala de conferência. "; +$text['description-users']['pl'] = "'Dodaj dodatkowych użytkowników jako administratorów tego pokoju konferencyjnego."; +$text['description-users']['sv-se'] = "Lägg till ytterligare användare som administratörer för detta konferensrum."; +$text['description-users']['uk'] = "Зв'язати додаткових користувачів як адміністраторів цього конференц-залу."; +$text['description-users']['de-at'] = "Weisen Sie diesem Konferenzraum weitere Administratoren zu. "; + $text['description-user_id']['en-us'] = "Enter the user ID."; $text['description-user_id']['es-cl'] = "Ingrese el ID de usuario."; $text['description-user_id']['pt-pt'] = "Introduza o ID do utilizador."; diff --git a/app/devices/device_edit.php b/app/devices/device_edit.php index 3ee1c1e8fe..5767872cb8 100644 --- a/app/devices/device_edit.php +++ b/app/devices/device_edit.php @@ -146,6 +146,8 @@ require_once "resources/require.php"; } unset ($prep_statement); } + //get assigned user + $user_uuid = check_str($_POST["user_uuid"]); //devices $device_label = check_str($_POST["device_label"]); $device_vendor = check_str($_POST["device_vendor"]); @@ -343,6 +345,7 @@ require_once "resources/require.php"; $device_label = $row["device_label"]; //$device_mac_address = substr($device_mac_address, 0,2).'-'.substr($device_mac_address, 2,2).'-'.substr($device_mac_address, 4,2).'-'.substr($device_mac_address, 6,2).'-'.substr($device_mac_address, 8,2).'-'.substr($device_mac_address, 10,2); $device_label = $row["device_label"]; + $user_uuid = $row["user_uuid"]; $device_username = $row["device_username"]; $device_password = $row["device_password"]; $device_vendor = $row["device_vendor"]; @@ -436,6 +439,14 @@ require_once "resources/require.php"; $device_settings[$x]['enabled'] = ''; $device_settings[$x]['device_setting_description'] = ''; +//get the users + $sql = "SELECT * FROM v_users "; + $sql .= "WHERE domain_uuid = '".$domain_uuid."' "; + $sql .= "ORDER by username asc "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $users = $prep_statement->fetchAll(PDO::FETCH_NAMED); + //use the mac address to get the vendor if (strlen($device_vendor) == 0) { $device_vendor = device::get_vendor($device_mac_address); @@ -1335,6 +1346,26 @@ require_once "resources/require.php"; echo " \n"; } + if (permission_exists('device_username')) { + echo "\n"; + echo "\n"; + echo " ".$text['label-users']."\n"; + echo "\n"; + echo "\n"; + echo " "; + if ($action == "update") { + echo " \n"; + } + unset($users); + echo "
\n"; + echo " ".$text['description-users']."\n"; + } + if (permission_exists('device_username_password')) { echo "\n"; echo "\n";