Run the users app defaults only once.

This commit is contained in:
Mark Crane 2014-12-26 15:47:37 +00:00
parent b9bb32f4bd
commit d573aa8b0b
1 changed files with 141 additions and 139 deletions

View File

@ -24,7 +24,8 @@
Mark J Crane <markjcrane@fusionpbx.com>
*/
//if the are no groups add the default groups
if ($domains_processed == 1) {
//if the are no groups add the default groups
$sql = "SELECT * FROM v_groups ";
$sql .= "WHERE domain_uuid = 'null' ";
$sub_result = $db->query($sql)->fetch();
@ -79,7 +80,7 @@
unset($prep_statement, $sub_result);
}
//if there are no permissions listed in v_group_permissions then set the default permissions
//if there are no permissions listed in v_group_permissions then set the default permissions
$sql = "select count(*) as count from v_group_permissions ";
$sql .= "where domain_uuid = null ";
$prep_statement = $db->prepare($sql);
@ -123,7 +124,7 @@
$db->commit();
}
//find rows that have a null group_uuid and set the correct group_uuid
//find rows that have a null group_uuid and set the correct group_uuid
$sql = "select * from v_group_users ";
$sql .= "where group_uuid is null; ";
$prep_statement = $db->prepare(check_sql($sql));
@ -135,7 +136,7 @@
//get the group_uuid
$sql = "select group_uuid from v_groups ";
$sql .= "where group_name = '".$row['group_name']."' ";
$sql .= "and domain_uuid = '".$row['domain_uuid']."' ";
//$sql .= "and domain_uuid = '".$row['domain_uuid']."' ";
$prep_statement_sub = $db->prepare($sql);
$prep_statement_sub->execute();
$sub_result = $prep_statement_sub->fetch(PDO::FETCH_ASSOC);
@ -152,7 +153,7 @@
unset ($prep_statement);
}
//if there are no permissions listed in v_group_permissions then set the default permissions
//if there are no permissions listed in v_group_permissions then set the default permissions
$sql = "select count(*) as count from v_users ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and user_enabled is null ";
@ -171,5 +172,6 @@
$db->exec($sql);
unset($sql);
}
}
?>