Merge branch 'ent-7951-Bloqueo-auto-creacion-usuarios-desde-nodo-en-entornos-centralizado' into 'develop'

Ent 7951 bloqueo auto creacion usuarios desde nodo en entornos centralizado

See merge request artica/pandorafms!4487
This commit is contained in:
Daniel Rodriguez 2021-11-03 09:34:49 +00:00
commit 56ae68a034
4 changed files with 25 additions and 13 deletions

View File

@ -1321,6 +1321,8 @@ if (isset($double_authentication)) {
if ($meta) { if ($meta) {
enterprise_include_once('include/functions_metaconsole.php'); enterprise_include_once('include/functions_metaconsole.php');
$access_node = db_get_value('metaconsole_access_node', 'tusuario', 'id_user', $id);
$metaconsole_agents_manager = '<div class="label_select_simple" id="metaconsole_agents_manager_div"><p class="edit_user_labels">'.__('Enable agents managment').'</p>'; $metaconsole_agents_manager = '<div class="label_select_simple" id="metaconsole_agents_manager_div"><p class="edit_user_labels">'.__('Enable agents managment').'</p>';
$metaconsole_agents_manager .= html_print_checkbox_switch( $metaconsole_agents_manager .= html_print_checkbox_switch(
'metaconsole_agents_manager', 'metaconsole_agents_manager',
@ -1342,7 +1344,7 @@ if ($meta) {
$metaconsole_access_node .= html_print_checkbox( $metaconsole_access_node .= html_print_checkbox(
'metaconsole_access_node', 'metaconsole_access_node',
1, 1,
$user_info['metaconsole_access_node'], $access_node,
true true
).'</div>'; ).'</div>';
} }

View File

@ -349,18 +349,24 @@ function process_user_login_remote($login, $pass, $api=false)
return false; return false;
} }
$user_info = [
'fullname' => $login,
'comments' => 'Imported from '.$config['auth'],
];
if (is_metaconsole() === true) {
$user_info['metaconsole_access_node'] = $config['ad_adv_user_node'];
}
// Create the user. // Create the user.
if (enterprise_hook( if (enterprise_hook(
'prepare_permissions_groups_of_user_ad', 'prepare_permissions_groups_of_user_ad',
[ [
$login, $login,
$pass, $pass,
[ $user_info,
'fullname' => $login,
'comments' => 'Imported from '.$config['auth'],
],
false, false,
defined('METACONSOLE'), defined('METACONSOLE') && is_centralized() === false,
] ]
) === false ) === false
) { ) {
@ -373,6 +379,10 @@ function process_user_login_remote($login, $pass, $api=false)
return false; return false;
} }
if (is_metaconsole() === true) {
$user_info['metaconsole_access_node'] = $config['ldap_adv_user_node'];
}
$permissions = fill_permissions_ldap($sr); $permissions = fill_permissions_ldap($sr);
if (empty($permissions) === true) { if (empty($permissions) === true) {
$config['auth_error'] = __('User not found in database or incorrect password'); $config['auth_error'] = __('User not found in database or incorrect password');
@ -387,7 +397,7 @@ function process_user_login_remote($login, $pass, $api=false)
$pass, $pass,
$user_info, $user_info,
$permissions, $permissions,
is_metaconsole() is_metaconsole() && is_centralized() === false
); );
} }
} else { } else {

View File

@ -1732,9 +1732,9 @@ function is_management_allowed($hkey='')
$nodes = (int) $nodes; $nodes = (int) $nodes;
} }
return ( (is_metaconsole() && (is_centrallised() || $nodes === 0)) return ( (is_metaconsole() && (is_centralized() || $nodes === 0))
|| (!is_metaconsole() && !is_centrallised()) || (!is_metaconsole() && !is_centralized())
|| (!is_metaconsole() && is_centrallised()) && $hkey == generate_hash_to_api()); || (!is_metaconsole() && is_centralized()) && $hkey == generate_hash_to_api());
} }
@ -1743,7 +1743,7 @@ function is_management_allowed($hkey='')
* *
* @return boolean * @return boolean
*/ */
function is_centrallised() function is_centralized()
{ {
global $config; global $config;
@ -1763,7 +1763,7 @@ function is_centrallised()
*/ */
function is_central_policies() function is_central_policies()
{ {
return is_metaconsole() && is_centrallised(); return is_metaconsole() && is_centralized();
} }

View File

@ -452,7 +452,7 @@ if (check_acl($config['id_user'], 0, 'ER')) {
$autorefresh_list_out = []; $autorefresh_list_out = [];
if (is_metaconsole() === false || is_centrallised() === true) { if (is_metaconsole() === false || is_centralized() === true) {
$autorefresh_list_out['operation/agentes/estado_agente'] = 'Agent detail'; $autorefresh_list_out['operation/agentes/estado_agente'] = 'Agent detail';
$autorefresh_list_out['operation/agentes/alerts_status'] = 'Alert detail'; $autorefresh_list_out['operation/agentes/alerts_status'] = 'Alert detail';
$autorefresh_list_out['enterprise/operation/cluster/cluster'] = 'Cluster view'; $autorefresh_list_out['enterprise/operation/cluster/cluster'] = 'Cluster view';