tags_get_acl_tags revision

This commit is contained in:
danielmaya 2018-10-08 17:45:26 +02:00
parent 441458843f
commit f952d5c70e
4 changed files with 21 additions and 13 deletions

View File

@ -420,9 +420,11 @@ foreach ($layoutDatas as $layoutData) {
}
else {
if ($layoutData['id_agent'] != 0) {
$modules = agents_meta_get_modules(
$layoutData['id_metaconsole'],
$layoutData['id_agent']);
$server = db_get_row('tmetaconsole_setup', 'id', $layoutData['id_metaconsole']);
if (metaconsole_connect($server) == NOERR) {
$modules = agents_get_modules($layoutData['id_agent']);
metaconsole_restore_db();
}
}
}

View File

@ -2267,7 +2267,7 @@ function graph_event_module ($width = 300, $height = 200, $id_agent) {
// Fix: tag filters implemented! for tag functionality groups have to be all user_groups (propagate ACL funct!)
$groups = users_get_groups($config["id_user"]);
// TODO revision tag
$tags_condition = tags_get_acl_tags($config['id_user'], array_keys($groups), 'ER', 'event_condition', 'AND');
$data = array ();
@ -2771,7 +2771,6 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
}
// Add tags condition to filter
// TODO revision tag
$tags_condition = tags_get_acl_tags($config['id_user'], 0, 'ER', 'event_condition', 'AND');
//This will give the distinct id_agente, give the id_grupo that goes
@ -2859,7 +2858,6 @@ function grafico_eventos_total($filter = "", $width = 320, $height = 200, $noWat
$filter = str_replace ( "\\" , "", $filter);
// Add tags condition to filter
// TODO revision tag
$tags_condition = tags_get_acl_tags($config['id_user'], 0, 'ER', 'event_condition', 'AND');
$filter .= $tags_condition;
@ -2873,8 +2871,11 @@ function grafico_eventos_total($filter = "", $width = 320, $height = 200, $noWat
}
$sql = sprintf("SELECT criticity, COUNT(id_evento) events
FROM tevento %s
GROUP BY criticity ORDER BY events DESC", $where);
FROM tevento
LEFT JOIN tagent_secondary_group tasg
ON tevento.id_agente = tasg.id_agent
%s %s
GROUP BY criticity ORDER BY events DESC", $where , $filter);
$criticities = db_get_all_rows_sql ($sql, false, false);

View File

@ -1145,7 +1145,7 @@ function tags_checks_event_acl($id_user, $id_group, $access, $tags = array(), $c
if (users_is_admin($id_user)) {
return true;
}
// TODO revision tag
$tags_user = tags_get_acl_tags($id_user, $id_group, $access, 'data', '', '', true, $childrens_ids, true);
// If there are wrong parameters or fail ACL check, return false
if ($tags_user === ERR_WRONG_PARAMETERS || $tags_user === ERR_ACL) {

View File

@ -281,8 +281,7 @@ class Modules {
$modules = array();
$modules_db = array();
$sql_conditions_base = " WHERE tagente.id_agente = tagente_modulo.id_agente
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo";
$sql_conditions_base = " WHERE 1=1";
// Part SQL for the id_agent
@ -302,7 +301,6 @@ class Modules {
// Part SQL for the Tag
// TODO revision tag
$sql_conditions_tags = tags_get_acl_tags($user->getIdUser(),
$user->getIdGroups($this->acl), $this->acl, 'module_condition', 'AND', 'tagente_modulo');
@ -401,7 +399,14 @@ class Modules {
$sql_total = "SELECT count(*)";
$sql = " FROM tagente, tagente_modulo, tagente_estado" .
$sql = " FROM tagente INNER JOIN tagente_modulo
ON tagente_modulo.id_agente = tagente.id_agente
INNER JOIN tagente_estado
ON tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
LEFT JOIN tagent_secondary_group tasg
ON tagente.id_agente = tasg.id_agent
LEFT JOIN ttag_module
ON ttag_module.id_agente_modulo = tagente_modulo.id_agente_modulo" .
$sql_conditions_all;
$sql_limit = "ORDER BY tagente.nombre ASC ";