Merge branch '2219-Query_satura_base_de_datos_NT' into 'develop'

tags secondary groups patch

See merge request artica/pandorafms!1452
This commit is contained in:
vgilc 2018-04-26 15:11:43 +02:00
commit 830a2090fb
1 changed files with 25 additions and 7 deletions

View File

@ -733,7 +733,8 @@ function tags_get_acl_tags_module_condition($acltags, $modules_table = '') {
AND ttmc.id_tag IN (%s)', AND ttmc.id_tag IN (%s)',
is_array($group_tags) ? implode(',', $group_tags) : $group_tags); is_array($group_tags) ? implode(',', $group_tags) : $group_tags);
} }
// FIXME: Not properly way to increse performance
if(enterprise_hook('agents_is_using_secondary_groups')){
$agent_condition = sprintf('SELECT tamc.id_agente_modulo $agent_condition = sprintf('SELECT tamc.id_agente_modulo
FROM tagente_modulo tamc FROM tagente_modulo tamc
%s %s
@ -743,6 +744,17 @@ function tags_get_acl_tags_module_condition($acltags, $modules_table = '') {
ON tasg.id_agent = tac.id_agente ON tasg.id_agent = tac.id_agente
WHERE (tac.id_grupo = %d OR tasg.id_group = %d)', WHERE (tac.id_grupo = %d OR tasg.id_group = %d)',
$tag_join, $group_id, $group_id); $tag_join, $group_id, $group_id);
}
else{
$agent_condition = sprintf('SELECT tamc.id_agente_modulo
FROM tagente_modulo tamc
%s
INNER JOIN tagente tac
ON tamc.id_agente = tac.id_agente
AND tac.id_grupo = %d',
$tag_join, $group_id);
}
$sql_condition = sprintf('(%sid_agente_modulo IN (%s))', $modules_table, $agent_condition); $sql_condition = sprintf('(%sid_agente_modulo IN (%s))', $modules_table, $agent_condition);
$group_conditions[] = $sql_condition; $group_conditions[] = $sql_condition;
@ -859,8 +871,14 @@ function tags_get_acl_tags_event_condition($acltags, $meta = false, $force_group
// Tags condition (The module has at least one of the restricted tags) // Tags condition (The module has at least one of the restricted tags)
$tags_condition = ''; $tags_condition = '';
if (empty($group_tags)) { if (empty($group_tags)) {
// FIXME: Not properly way to increse performance
if(enterprise_hook('agents_is_using_secondary_groups')){
$tags_condition = "id_grupo = ".$group_id . " OR id_group = " . $group_id; $tags_condition = "id_grupo = ".$group_id . " OR id_group = " . $group_id;
} }
else{
$tags_condition = "id_grupo = ".$group_id;
}
}
else { else {
if (!is_array($group_tags)) { if (!is_array($group_tags)) {
$group_tags = explode(',', $group_tags); $group_tags = explode(',', $group_tags);