Update app_defaults.php
This commit is contained in:
@@ -3,54 +3,47 @@
|
|||||||
if ($domains_processed == 1) {
|
if ($domains_processed == 1) {
|
||||||
|
|
||||||
//add the permissions
|
//add the permissions
|
||||||
$sql = "select count(*) from v_permissions";
|
$sql = "delete from v_permissions";
|
||||||
$database = new database;
|
$database = new database;
|
||||||
$num_rows = $database->select($sql, null, 'column');
|
$database->execute($sql, null);
|
||||||
if ($num_rows == 0) {
|
|
||||||
|
|
||||||
//get the $apps array from the installed apps from the core and mod directories
|
//get the $apps array from the installed apps from the core and mod directories
|
||||||
$config_list = glob($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/*/*/app_config.php");
|
$config_list = glob($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/*/*/app_config.php");
|
||||||
$x = 0;
|
$x = 0;
|
||||||
foreach ($config_list as &$config_path) {
|
foreach ($config_list as &$config_path) {
|
||||||
include($config_path);
|
include($config_path);
|
||||||
|
$x++;
|
||||||
|
}
|
||||||
|
|
||||||
|
//restore default permissions
|
||||||
|
$x = 0;
|
||||||
|
foreach ($apps as $row) {
|
||||||
|
if (is_array($row['permissions']) && @sizeof($row['permissions']) != 0) {
|
||||||
|
foreach ($row['permissions'] as $permission) {
|
||||||
|
$array['permissions'][$x]['permission_uuid'] = uuid();
|
||||||
|
$array['permissions'][$x]['permission_name'] = $permission['name'];
|
||||||
|
$array['permissions'][$x]['application_name'] = $row['name'];
|
||||||
|
$array['permissions'][$x]['application_uuid'] = $row['uuid'];
|
||||||
$x++;
|
$x++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//restore default permissions
|
//save the data to the database
|
||||||
$x = 0;
|
if (is_array($array) && @sizeof($array)) {
|
||||||
foreach ($apps as $row) {
|
//grant temporary permissions
|
||||||
if (is_array($row['permissions']) && @sizeof($row['permissions']) != 0) {
|
$p = new permissions;
|
||||||
foreach ($row['permissions'] as $permission) {
|
$p->add('permission_add', 'temp');
|
||||||
if ($permission['groups']) {
|
|
||||||
foreach ($permission['groups'] as $group_name) {
|
|
||||||
$array['permissions'][$x]['permission_uuid'] = uuid();
|
|
||||||
$array['permissions'][$x]['permission_name'] = $permission['name'];
|
|
||||||
$array['permissions'][$x]['application_name'] = $row['name'];
|
|
||||||
$array['permissions'][$x]['application_uuid'] = $row['uuid'];
|
|
||||||
$x++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//save the data to the database
|
//execute insert
|
||||||
if (is_array($array) && @sizeof($array)) {
|
$database = new database;
|
||||||
//grant temporary permissions
|
$database->app_name = 'permissions';
|
||||||
$p = new permissions;
|
$database->app_uuid = 'ce1498a0-46e2-487d-85de-4eec7122a984';
|
||||||
$p->add('permission_add', 'temp');
|
$database->save($array);
|
||||||
|
unset($array);
|
||||||
//execute insert
|
|
||||||
$database = new database;
|
|
||||||
$database->app_name = 'permissions';
|
|
||||||
$database->app_uuid = 'ce1498a0-46e2-487d-85de-4eec7122a984';
|
|
||||||
$database->save($array);
|
|
||||||
unset($array);
|
|
||||||
|
|
||||||
//revoke temporary permissions
|
|
||||||
$p->delete('permission_add', 'temp');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
//revoke temporary permissions
|
||||||
|
$p->delete('permission_add', 'temp');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user