From 0f78d87504b0a3d5183c27069ac47ea5fcbccc29 Mon Sep 17 00:00:00 2001 From: manuel Date: Wed, 10 Apr 2019 16:12:22 +0200 Subject: [PATCH] Fixed bug in save profile users Former-commit-id: 8f79e2c3de0e7cedb581d90e53f39ef176afe040 --- pandora_console/include/auth/mysql.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/auth/mysql.php b/pandora_console/include/auth/mysql.php index 6ccd6f9a1e..d5a41280f7 100644 --- a/pandora_console/include/auth/mysql.php +++ b/pandora_console/include/auth/mysql.php @@ -1253,7 +1253,25 @@ function fill_permissions_ldap($sr) { global $config; $permissions = []; - if ($config['autocreate_remote_users'] && $config['ldap_save_profile']) { + $permissions_profile = []; + if ((bool) $config['ldap_save_profile'] === false) { + $result = db_get_all_rows_filter( + 'tusuario_perfil', + ['id_usuario' => $sr['uid'][0]] + ); + foreach ($result as $perms) { + $permissions_profile[] = [ + 'profile' => $perms['id_perfil'], + 'groups' => [$perms['id_grupo']], + 'tags' => $perms['tags'], + 'no_hierarchy' => (bool) $perms['no_hierarchy'] ? 1 : 0, + ]; + } + + return $permissions_profile; + } + + if ($config['autocreate_remote_users']) { $permissions[0]['profile'] = $config['default_remote_profile']; $permissions[0]['groups'][] = $config['default_remote_group']; $permissions[0]['tags'] = $config['default_assign_tags'];