Index: branches/unlabeled/unlabeled-1.20.2/core/units/general/helpers/permissions_helper.php =================================================================== diff -u -r6873 -r7055 --- branches/unlabeled/unlabeled-1.20.2/core/units/general/helpers/permissions_helper.php (.../permissions_helper.php) (revision 6873) +++ branches/unlabeled/unlabeled-1.20.2/core/units/general/helpers/permissions_helper.php (.../permissions_helper.php) (revision 7055) @@ -367,6 +367,17 @@ // that (perm cache creator) code thinks that it is allowed & adds corresponding record and code below will // return incorrect results + if ($user_id == $this->Application->RecallVar('user_id')) { + $groups = explode(',', $this->Application->RecallVar('UserGroups')); + } + else { // checking not current user + $sql = 'SELECT GroupId FROM '.TABLE_PREFIX.'UserGroup + WHERE (PortalUserId = '.$user_id.') AND + ( (MembershipExpires IS NULL) OR ( MembershipExpires >= UNIX_TIMESTAMP() ) )'; + $groups = $this->Conn->GetCol($sql); + array_push($groups, $this->Application->ConfigValue('User_LoggedInGroup') ); + } + if (preg_match('/(.*)\.VIEW$/', $name) && ($type == 0)) { // cached view permission of category: begin $sql = 'SELECT PermissionConfigId @@ -379,16 +390,6 @@ WHERE (PermId = '.$perm_id.') AND (CategoryId = '.$cat_id.')'; $view_filters = Array(); - if ($user_id == $this->Application->RecallVar('user_id')) { - $groups = explode(',', $this->Application->RecallVar('UserGroups')); - } - else { // checking not current user - $sql = 'SELECT GroupId FROM '.TABLE_PREFIX.'UserGroup - WHERE (PortalUserId = '.$user_id.') AND - ( (MembershipExpires IS NULL) OR ( MembershipExpires >= UNIX_TIMESTAMP() ) )'; - $groups = $this->Conn->GetCol($sql); - array_push($groups, $this->Application->ConfigValue('User_LoggedInGroup') ); - } foreach ($groups as $group) { $view_filters[] = 'FIND_IN_SET('.$group.', ACL)'; } @@ -414,7 +415,7 @@ } $perm_value = 0; - $groups = $this->Application->RecallVar('UserGroups'); + $groups = implode(',',$groups); foreach ($cat_hierarchy as $category_id) { $sql = 'SELECT SUM(PermissionValue) FROM '.TABLE_PREFIX.'Permissions