diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index b4e25c9eac..1ef37e74bc 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -1796,6 +1796,26 @@ function check_acl($id_user, $id_group, $access, $onlyOneGroup = false) { $id_group = (int) $id_group; } + if($_SESSION['check_acl'] != null){ + if (empty ($_SESSION['check_acl'])) + return 0; + + $result = 0; + $acl_column = get_acl_column($access); + foreach ($_SESSION['check_acl'] as $row) { + // For each profile for this pair of group and user do... + if (isset($row[$acl_column])) { + $result += $row[$acl_column]; + } + } + + if ($result >= 1) { + return 1; + } + + return 0; + } + $parents_id = array($id_group); if ($id_group != 0 && $onlyOneGroup !== true) { $group = db_get_row_filter('tgrupo', array('id_grupo' => $id_group)); @@ -1844,8 +1864,13 @@ function check_acl($id_user, $id_group, $access, $onlyOneGroup = false) { OR tusuario_perfil.id_grupo = 0)", $id_user, implode(', ', $parents_id)); } + + + $rowdup = db_get_all_rows_sql ($query); + $_SESSION['check_acl'] = $rowdup; + if (empty ($rowdup)) return 0;