mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Update app_defaults.php
Add default device function group permissions.
This commit is contained in:
@@ -57,9 +57,22 @@ if ($domains_processed == 1) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($row['num_rows'] == 0) {
|
||||
|
||||
//get the vendor array
|
||||
require_once $_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH.'/app/devices/app_config.php';
|
||||
|
||||
//get the groups and create an array to use the name to get the uuid
|
||||
$sql = "select * from v_groups; ";
|
||||
$prep_statement = $db->prepare($sql);
|
||||
$prep_statement->execute();
|
||||
$groups = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
|
||||
unset($prep_statement);
|
||||
foreach ($groups as $row) {
|
||||
if ($row['domain_uuid'] == '') {
|
||||
$group_uuids[$row['group_name']] = $row['group_uuid'];
|
||||
}
|
||||
}
|
||||
|
||||
//process the array
|
||||
foreach ($vendors as $vendor) {
|
||||
|
||||
@@ -83,34 +96,63 @@ if ($domains_processed == 1) {
|
||||
|
||||
//add the vendor functions
|
||||
foreach ($vendor['functions'] as $function) {
|
||||
$device_vendor_function_uuid = uuid();
|
||||
$sql = "insert into v_device_vendor_functions ";
|
||||
$sql .= "(";
|
||||
$sql .= "device_vendor_uuid, ";
|
||||
$sql .= "device_vendor_function_uuid, ";
|
||||
//$sql .= "label, ";
|
||||
$sql .= "name, ";
|
||||
$sql .= "value, ";
|
||||
$sql .= "enabled, ";
|
||||
$sql .= "description ";
|
||||
$sql .= ") ";
|
||||
$sql .= "values ";
|
||||
$sql .= "( ";
|
||||
$sql .= "'".$device_vendor_uuid."', ";
|
||||
$sql .= "'".$device_vendor_function_uuid."', ";
|
||||
//$sql .= "'".$function['label']."', ";
|
||||
$sql .= "'".$function['name']."', ";
|
||||
$sql .= "'".$function['value']."', ";
|
||||
$sql .= "'true', ";
|
||||
$sql .= "'".$function['description']."' ";
|
||||
$sql .= ");";
|
||||
//echo $sql."\n";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
//get the id
|
||||
$device_vendor_function_uuid = uuid();
|
||||
|
||||
//add the device vendor funtction
|
||||
$sql = "insert into v_device_vendor_functions ";
|
||||
$sql .= "(";
|
||||
$sql .= "device_vendor_uuid, ";
|
||||
$sql .= "device_vendor_function_uuid, ";
|
||||
//$sql .= "label, ";
|
||||
$sql .= "name, ";
|
||||
$sql .= "value, ";
|
||||
$sql .= "enabled, ";
|
||||
$sql .= "description ";
|
||||
$sql .= ") ";
|
||||
$sql .= "values ";
|
||||
$sql .= "( ";
|
||||
$sql .= "'".$device_vendor_uuid."', ";
|
||||
$sql .= "'".$device_vendor_function_uuid."', ";
|
||||
//$sql .= "'".$function['label']."', ";
|
||||
$sql .= "'".$function['name']."', ";
|
||||
$sql .= "'".$function['value']."', ";
|
||||
$sql .= "'true', ";
|
||||
$sql .= "'".$function['description']."' ";
|
||||
$sql .= ");";
|
||||
//echo $sql."\n";
|
||||
$db->exec(check_sql($sql));
|
||||
unset($sql);
|
||||
|
||||
//add the device vendor function groups
|
||||
if (is_array($function['groups'])) {
|
||||
$sql = "insert into v_device_vendor_function_groups ";
|
||||
$sql .= "(";
|
||||
$sql .= "device_vendor_function_group_uuid, ";
|
||||
$sql .= "device_vendor_function_uuid, ";
|
||||
$sql .= "device_vendor_uuid, ";
|
||||
$sql .= "group_name, ";
|
||||
$sql .= "group_uuid ";
|
||||
$sql .= ") ";
|
||||
$sql .= "values ";
|
||||
$i = 0;
|
||||
foreach ($function['groups'] as $group_name) {
|
||||
if ($i == 0) { $sql .= "("; } else { $sql .= ",("; }
|
||||
$sql .= "'".uuid()."', ";
|
||||
$sql .= "'".$device_vendor_function_uuid."', ";
|
||||
$sql .= "'".$device_vendor_uuid."', ";
|
||||
$sql .= "'$group_name', ";
|
||||
$sql .= "'".$group_uuids[$group_name]."' ";
|
||||
$sql .= ")";
|
||||
$i++;
|
||||
}
|
||||
$db->exec($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} //if num_rows
|
||||
} //if prep_statement
|
||||
} // if prep_statement
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user