From 07b42f72419f6154cac75c86085c0807fc2c37bc Mon Sep 17 00:00:00 2001 From: "marcos.alconada" Date: Wed, 22 May 2019 13:57:31 +0200 Subject: [PATCH] Changed for metaconsole --- pandora_console/include/auth/mysql.php | 32 +++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/auth/mysql.php b/pandora_console/include/auth/mysql.php index 2ce943b9da..1ab383b672 100644 --- a/pandora_console/include/auth/mysql.php +++ b/pandora_console/include/auth/mysql.php @@ -1254,6 +1254,36 @@ function fill_permissions_ldap($sr) global $config; $permissions = []; $permissions_profile = []; + if (defined('METACONSOLE')) { + $meta = true; + } + + if ($meta && (bool) $config['ldap_save_profile'] === false && $config['ldap_advanced_config'] == 0) { + $result = 0; + $result = db_get_all_rows_filter( + 'tusuario_perfil', + ['id_usuario' => $sr['uid'][0]] + ); + if ($result == false) { + $permissions[0]['profile'] = $config['default_remote_profile']; + $permissions[0]['groups'][] = $config['default_remote_group']; + $permissions[0]['tags'] = $config['default_assign_tags']; + $permissions[0]['no_hierarchy'] = $config['default_no_hierarchy']; + return $permissions; + } + + 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 ((bool) $config['ldap_save_profile'] === false && $config['ldap_advanced_config'] == '') { $result = db_get_all_rows_filter( 'tusuario_perfil', @@ -1293,7 +1323,7 @@ function fill_permissions_ldap($sr) return $permissions; } - if ($config['ldap_advanced_config'] == 1 && $config['ldap_save_profile'] == '') { + if ($config['ldap_advanced_config'] == 1 && $config['ldap_save_profile'] == 0) { $result = db_get_all_rows_filter( 'tusuario_perfil', ['id_usuario' => $sr['uid'][0]]