Add ability to assign a single user to a device.

This commit is contained in:
markjcrane 2016-05-20 10:39:16 -06:00
parent cf3620f9d0
commit 0cc9a01a5a
3 changed files with 65 additions and 0 deletions

View File

@ -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'] = "";

View File

@ -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.";

View File

@ -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 " </tr>\n";
}
if (permission_exists('device_username')) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-users']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select name=\"user_uuid\" class='formfld' style='width: auto;'>\n";
echo " <option value=\"\"></option>\n";
foreach($users as $field) {
echo " <option value='".$field['user_uuid']."'>".$field['username']."</option>\n";
}
echo " </select>";
if ($action == "update") {
echo " <input type=\"submit\" class='btn' value=\"".$text['button-add']."\">\n";
}
unset($users);
echo " <br>\n";
echo " ".$text['description-users']."\n";
}
if (permission_exists('device_username_password')) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";