Merge branch 'ent-12704-tactival-view-con-usuario-no-admin-no-muestra-eventos-del-sistema' into 'develop'

fix search events pandora_enterprise#12704

See merge request artica/pandorafms!6809
This commit is contained in:
Rafael Ameijeiras 2023-12-26 13:56:53 +00:00
commit 46fb63394b
1 changed files with 11 additions and 5 deletions

View File

@ -953,11 +953,14 @@ function events_get_all(
} }
} }
$groups = (isset($filter['id_group_filter']) === true) ? $filter['id_group_filter'] : null; $groups = false;
if ((bool) $user_is_admin === false $filter_groups = false;
&& isset($groups) === false if (isset($filter['id_group_filter']) === true
&& empty($filter['id_group_filter']) === false
) { ) {
// Not being filtered by group but not an admin, limit results. $filter_groups = true;
$groups = $filter['id_group_filter'];
} else if ((bool) $user_is_admin === false) {
$groups = array_keys(users_get_groups(false, 'AR')); $groups = array_keys(users_get_groups(false, 'AR'));
} }
@ -1594,7 +1597,10 @@ function events_get_all(
&& (is_array($groups) === true && (is_array($groups) === true
|| $groups > 0) || $groups > 0)
) { ) {
if ($filter_groups === true) {
$tgrupo_join = 'INNER'; $tgrupo_join = 'INNER';
}
if (is_array($groups) === true) { if (is_array($groups) === true) {
if ((bool) $filter['search_secondary_groups'] === true) { if ((bool) $filter['search_secondary_groups'] === true) {
$tgrupo_join_filters[] = sprintf( $tgrupo_join_filters[] = sprintf(