Merge branch 'ent-3059-revision-de-la-funcion-metaconsole_connect' into 'develop'

multiple fixes

See merge request artica/pandorafms!3812
This commit is contained in:
Daniel Rodriguez 2021-04-12 10:39:41 +00:00
commit eeff80638f
4 changed files with 31 additions and 18 deletions

View File

@ -66,6 +66,7 @@ if (is_ajax()) {
function ($counter, $server) use ($id_tag) {
if (metaconsole_connect($server) === NOERR) {
$counter += tags_get_local_modules_count($id_tag);
metaconsole_restore_db();
}
return $counter;
@ -83,6 +84,7 @@ if (is_ajax()) {
function ($counter, $server) use ($id_tag) {
if (metaconsole_connect($server) === NOERR) {
$counter += tags_get_policy_modules_count($id_tag);
metaconsole_restore_db();
}
return $counter;
@ -272,6 +274,7 @@ if (!empty($result)) {
function ($counter, $server) use ($tag_id) {
if (metaconsole_connect($server) === NOERR) {
$counter += tags_get_modules_count($tag_id);
metaconsole_restore_db();
}
return $counter;

View File

@ -260,21 +260,21 @@ if (isset($_GET['user_del'])) {
if (defined('METACONSOLE') && isset($_GET['delete_all'])) {
$servers = metaconsole_get_servers();
foreach ($servers as $server) {
// Connect to the remote console
metaconsole_connect($server);
// Connect to the remote console.
if (metaconsole_connect($server) === NOERR) {
// Delete the user
$result = delete_user($id_user);
if ($result) {
db_pandora_audit(
'User management',
__('Deleted user %s from metaconsole', io_safe_input($id_user))
);
}
// Delete the user
$result = delete_user($id_user);
if ($result) {
db_pandora_audit(
'User management',
__('Deleted user %s from metaconsole', io_safe_input($id_user))
);
// Restore the db connection.
metaconsole_restore_db();
}
// Restore the db connection
metaconsole_restore_db();
// Log to the metaconsole too
if ($result) {
db_pandora_audit(

View File

@ -1477,15 +1477,21 @@ if ($get_extended_event) {
$related = events_page_related($event, $server);
}
$connected = true;
if ($meta) {
metaconsole_connect($server);
if (metaconsole_connect($server) === NOERR) {
$connected = true;
} else {
$connected = false;
}
}
$custom_fields = events_page_custom_fields($event);
if ($connected === true) {
$custom_fields = events_page_custom_fields($event);
$custom_data = events_page_custom_data($event);
}
$custom_data = events_page_custom_data($event);
if ($meta) {
if ($meta && $connected === true) {
metaconsole_restore_db();
}

View File

@ -2853,7 +2853,11 @@ function can_user_access_node()
{
global $config;
$userinfo = get_user_info($config['id_user']);
static $userinfo;
if ($userinfo === null) {
$userinfo = get_user_info($config['id_user']);
}
if (is_metaconsole()) {
return $userinfo['is_admin'] == 1 ? 1 : $userinfo['metaconsole_access_node'];