mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Sort all Group select boxes by group_name asc.
Create User now allows to select a single Group to add User to at time of User creation.
This commit is contained in:
@@ -172,6 +172,7 @@ if (count($_POST)>0) {
|
||||
//---- Begin Select List --------------------
|
||||
$sql = "SELECT * FROM v_groups ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "order by group_name asc ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
|
||||
|
||||
@@ -203,6 +203,7 @@ else {
|
||||
//---- Begin Select List --------------------
|
||||
$sql = "SELECT * FROM v_groups ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "order by group_name asc ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
|
||||
|
||||
@@ -407,6 +407,7 @@ else {
|
||||
echo "<br />\n";
|
||||
$sql = "SELECT * FROM v_groups ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "order by group_name asc ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
echo "<select name=\"group_name\" class='formfld' style='width: auto; margin-right: 3px;'>\n";
|
||||
|
||||
@@ -142,6 +142,11 @@
|
||||
$text['label-user_info']['pt-pt'] = "Informação do Utilizador";
|
||||
$text['label-user_info']['fr-fr'] = "Informations sur l'utilisateur";
|
||||
|
||||
$text['label-group']['en-us'] = "Group";
|
||||
$text['label-group']['es-cl'] = "Grupo";
|
||||
$text['label-group']['pt-pt'] = "Grupo";
|
||||
$text['label-group']['fr-fr'] = "Group";
|
||||
|
||||
$text['label-groups']['en-us'] = "Groups";
|
||||
$text['label-groups']['es-cl'] = "Grupos";
|
||||
$text['label-groups']['pt-pt'] = "Grupos";
|
||||
|
||||
@@ -44,10 +44,12 @@ else {
|
||||
$username = check_str($_POST["username"]);
|
||||
$password = check_str($_POST["password"]);
|
||||
$confirmpassword = check_str($_POST["confirmpassword"]);
|
||||
$group_name = check_str($_POST["group_name"]);
|
||||
$user_email = check_str($_POST["user_email"]);
|
||||
$contact_organization = check_str($_POST["contact_organization"]);
|
||||
$contact_name_given = check_str($_POST["contact_name_given"]);
|
||||
$contact_name_family = check_str($_POST["contact_name_family"]);
|
||||
$user_email = check_str($_POST["user_email"]);
|
||||
|
||||
|
||||
if (count($_POST)>0 && check_str($_POST["persistform"]) != "1") {
|
||||
|
||||
@@ -106,6 +108,7 @@ if (count($_POST)>0 && check_str($_POST["persistform"]) != "1") {
|
||||
|
||||
//prepare the uuids
|
||||
$user_uuid = uuid();
|
||||
$group_user_uuid = uuid();
|
||||
$contact_uuid = uuid();
|
||||
|
||||
//add the user
|
||||
@@ -136,6 +139,28 @@ if (count($_POST)>0 && check_str($_POST["persistform"]) != "1") {
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//add the user to the group
|
||||
if (strlen($group_name) > 0) {
|
||||
if ( ($group_name == "superadmin" && if_group("superadmin")) || $group_name != "superadmin") {
|
||||
$sql = "insert into v_group_users ";
|
||||
$sql .= "( ";
|
||||
$sql .= "group_user_uuid, ";
|
||||
$sql .= "domain_uuid, ";
|
||||
$sql .= "group_name, ";
|
||||
$sql .= "user_uuid ";
|
||||
$sql .= ") ";
|
||||
$sql .= "values ";
|
||||
$sql .= "(";
|
||||
$sql .= "'".$group_user_uuid."', ";
|
||||
$sql .= "'".$domain_uuid."', ";
|
||||
$sql .= "'".$group_name."', ";
|
||||
$sql .= "'".$user_uuid."' ";
|
||||
$sql .= ")";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
}
|
||||
}
|
||||
|
||||
//add to contacts
|
||||
$sql = "insert into v_contacts ";
|
||||
$sql .= "(";
|
||||
@@ -214,6 +239,27 @@ if (count($_POST)>0 && check_str($_POST["persistform"]) != "1") {
|
||||
echo " <td class='vtable'><input type='text' class='formfld' name='user_email' value='$user_email'></td>";
|
||||
echo " </tr>";
|
||||
echo " <tr>";
|
||||
echo " <td class='vncell' valign='top'>".$text['label-group'].":</td>";
|
||||
echo " <td class='vtable'>";
|
||||
$sql = "SELECT * FROM v_groups ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "order by group_name asc ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
echo " <select name=\"group_name\" class='formfld' style='width: auto; margin-right: 3px;'>\n";
|
||||
echo " <option value=\"\"></option>\n";
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
foreach($result as $field) {
|
||||
if ($field['group_name'] == "superadmin" && !if_group("superadmin")) { continue; } //only show the superadmin group to other users in the superadmin group
|
||||
if (!in_array($field["group_name"], $assigned_groups)) {
|
||||
echo " <option value='".$field['group_name']."'>".$field['group_name']."</option>\n";
|
||||
}
|
||||
}
|
||||
echo " </select>";
|
||||
unset($sql, $result);
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo " <tr>";
|
||||
echo " <td class='vncell'>".$text['label-first_name'].":</td>";
|
||||
echo " <td class='vtable'><input type='text' class='formfld' name='contact_name_given' value='$contact_name_given'></td>";
|
||||
echo " </tr>";
|
||||
|
||||
@@ -454,6 +454,7 @@ else {
|
||||
echo "<br />\n";
|
||||
$sql = "SELECT * FROM v_groups ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "order by group_name asc ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
echo "<select name=\"group_name\" class='formfld' style='width: auto; margin-right: 3px;'>\n";
|
||||
|
||||
Reference in New Issue
Block a user