Fixed ad advanced perms params saving

Former-commit-id: a0aa5b3b666b0a990dfb087029f6e0bb2929292e
This commit is contained in:
Luis Calvo 2019-02-22 10:54:17 +01:00
parent e55915e1e2
commit ea4b24de2e
1 changed files with 20 additions and 12 deletions

View File

@ -2089,9 +2089,9 @@ function config_process_config()
if (!isset($config['ad_adv_perms'])) {
config_update_value('ad_adv_perms', '');
} else {
$temp_ad_adv_perms = [];
if (!json_decode(io_safe_output($config['ad_adv_perms']))) {
$temp_ad_adv_perms = [];
if (!isset($config['ad_adv_perms']) && $config['ad_adv_perms'] != '') {
if ($config['ad_adv_perms'] != '') {
$perms = explode(';', io_safe_output($config['ad_adv_perms']));
foreach ($perms as $ad_adv_perm) {
if (preg_match('/[\[\]]/', $ad_adv_perm)) {
@ -2154,22 +2154,26 @@ function config_process_config()
if (!empty($new_ad_adv_perms)) {
$temp_ad_adv_perms = json_encode($new_ad_adv_perms);
}
} else {
$temp_ad_adv_perms = '';
}
config_update_value('ad_adv_perms', $temp_ad_adv_perms);
} else {
$temp_ad_adv_perms = $config['ad_adv_perms'];
}
config_update_value('ad_adv_perms', $temp_ad_adv_perms);
}
if (!isset($config['ldap_adv_perms'])) {
config_update_value('ldap_adv_perms', '');
} else {
$temp_ldap_adv_perms = [];
if (!json_decode(io_safe_output($config['ldap_adv_perms']))) {
$temp_ldap_adv_perms = [];
if (!isset($config['ad_adv_perms']) && $config['ldap_adv_perms'] != '') {
if ($config['ldap_adv_perms'] != '') {
$perms = explode(';', io_safe_output($config['ldap_adv_perms']));
foreach ($perms as $ad_adv_perm) {
if (preg_match('/[\[\]]/', $ad_adv_perm)) {
$all_data = explode(',', io_safe_output($ad_adv_perm));
foreach ($perms as $ldap_adv_perm) {
if (preg_match('/[\[\]]/', $ldap_adv_perm)) {
$all_data = explode(',', io_safe_output($ldap_adv_perm));
$profile = $all_data[0];
$group_pnd = $all_data[1];
$groups_ad = str_replace(['[', ']'], '', $all_data[2]);
@ -2199,7 +2203,7 @@ function config_process_config()
'groups_ldap' => $groups_ldap,
];
} else {
$all_data = explode(',', io_safe_output($ad_adv_perm));
$all_data = explode(',', io_safe_output($ldap_adv_perm));
$profile = $all_data[0];
$group_pnd = $all_data[1];
$groups_ad = $all_data[2];
@ -2228,10 +2232,14 @@ function config_process_config()
if (!empty($new_ldap_adv_perms)) {
$temp_ldap_adv_perms = json_encode($new_ldap_adv_perms);
}
} else {
$temp_ldap_adv_perms = '';
}
config_update_value('ldap_adv_perms', $temp_ldap_adv_perms);
} else {
$temp_ldap_adv_perms = $config['ldap_adv_perms'];
}
config_update_value('ldap_adv_perms', $temp_ldap_adv_perms);
}
if (!isset($config['rpandora_server'])) {