Wip command center, clean functions db

This commit is contained in:
Daniel Barbero Martin 2021-06-10 08:45:50 +02:00
parent 5b9098b7b0
commit a9864f7d87
4 changed files with 4 additions and 33 deletions

View File

@ -511,12 +511,6 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
enterprise_include_once('meta/include/functions_ui_meta.php');
include_graphs_dependencies();
$is_extra = enterprise_hook('policies_is_agent_extra_policy', [$id_agente]);
if ($is_extra === ENTERPRISE_NOT_HOOK) {
$is_extra = false;
}
$user_access_node = can_user_access_node();
if (is_metaconsole()) {
@ -550,7 +544,6 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false)
if (! check_acl_one_of_groups($config['id_user'], $groups, 'AR', false)
&& ! check_acl_one_of_groups($config['id_user'], $groups, 'AW', false)
&& !$is_extra
) {
db_pandora_audit(
'ACL Violation',

View File

@ -129,21 +129,12 @@ if ($idAgent != 0) {
$id_group = agents_get_agent_group($idAgent);
$is_extra = enterprise_hook(
'policies_is_agent_extra_policy',
[$id_agente]
);
if ($is_extra === ENTERPRISE_NOT_HOOK) {
$is_extra = false;
}
// All groups is calculated in ver_agente.php. Avoid to calculate it again
// All groups is calculated in ver_agente.php. Avoid to calculate it again.
if (!isset($all_groups)) {
$all_groups = agents_get_all_groups_agent($idAgent, $id_group);
}
if (!check_acl_one_of_groups($config['id_user'], $all_groups, 'AR') && !check_acl_one_of_groups($config['id_user'], $id_group, 'AW') && !$is_extra) {
if (!check_acl_one_of_groups($config['id_user'], $all_groups, 'AR') && !check_acl_one_of_groups($config['id_user'], $id_group, 'AW')) {
db_pandora_audit('ACL Violation', 'Trying to access alert view');
include 'general/noaccess.php';
exit;

View File

@ -63,15 +63,8 @@ if ($agent === false) {
return;
}
$is_extra = enterprise_hook('policies_is_agent_extra_policy', [$id_agente]);
if ($is_extra === ENTERPRISE_NOT_HOOK) {
$is_extra = false;
}
if (! check_acl_one_of_groups($config['id_user'], $all_groups, 'AR')
&& ! check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')
&& !$is_extra
) {
db_pandora_audit(
'ACL Violation',

View File

@ -1222,15 +1222,9 @@ $agent = db_get_row('tagente', 'id_agente', $id_agente);
// Get group for this id_agente.
$id_grupo = $agent['id_grupo'];
$is_extra = enterprise_hook('policies_is_agent_extra_policy', [$id_agente]);
if ($is_extra === ENTERPRISE_NOT_HOOK) {
$is_extra = false;
}
$all_groups = agents_get_all_groups_agent($id_agente, $id_grupo);
if (! check_acl_one_of_groups($config['id_user'], $all_groups, 'AR') && ! check_acl_one_of_groups($config['id_user'], $all_groups, 'AW', $id_agente) && !$is_extra) {
if (! check_acl_one_of_groups($config['id_user'], $all_groups, 'AR') && ! check_acl_one_of_groups($config['id_user'], $all_groups, 'AW', $id_agente)) {
db_pandora_audit(
'ACL Violation',
'Trying to access (read) to agent '.agents_get_name($id_agente)
@ -1283,7 +1277,7 @@ $tab = get_parameter('tab', 'main');
// Manage tab.
$managetab = [];
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') || $is_extra) {
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'AW')) {
$managetab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.'">'.html_print_image(
'images/setup.png',
true,