Index: trunk/core/units/general/helpers/permissions_helper.php =================================================================== diff -u -N -r5186 -r5218 --- trunk/core/units/general/helpers/permissions_helper.php (.../permissions_helper.php) (revision 5186) +++ trunk/core/units/general/helpers/permissions_helper.php (.../permissions_helper.php) (revision 5218) @@ -313,25 +313,29 @@ // that (perm cache creator) code thinks that it is allowed & adds corresponding record and code below will // return incorrect results - /*if (preg_match('/(.*)\.VIEW$/', $name) && ($type == 0)) { + if (preg_match('/(.*)\.VIEW$/', $name) && ($type == 0)) { // cached view permission of category: begin - $sql = 'SELECT perm_cache.PermId - FROM '.TABLE_PREFIX.'PermCache perm_cache - LEFT JOIN '.TABLE_PREFIX.'PermissionConfig perm_config ON perm_cache.PermId = perm_config.PermissionConfigId - WHERE (perm_config.PermissionName = '.$this->Conn->qstr($name).' AND perm_cache.CategoryId = '.$cat_id.')'; + $sql = 'SELECT PermissionConfigId + FROM '.TABLE_PREFIX.'PermissionConfig + WHERE PermissionName = '.$this->Conn->qstr($name); + $perm_id = $this->Conn->GetOne($sql); + + $sql = 'SELECT PermId + FROM '.TABLE_PREFIX.'PermCache + WHERE (PermId = '.$perm_id.') AND (CategoryId = '.$cat_id.')'; $view_filters = Array(); $groups = explode(',', $this->Application->RecallVar('UserGroups')); foreach ($groups as $group) { - $view_filters[] = 'FIND_IN_SET('.$group.', perm_cache.ACL) || ((NOT FIND_IN_SET('.$group.', perm_cache.DACL)) AND perm_cache.ACL = \'\')'; + $view_filters[] = 'FIND_IN_SET('.$group.', ACL)'; } $sql .= ' AND ('.implode(' OR ', $view_filters).')'; $perm_value = $this->Conn->GetOne($sql) ? 1 : 0; $this->Application->setCache('permissions', $cache_key, $perm_value); return $perm_value; // cached view permission of category: end - }*/ + } if ($cat_id == 0) { $cat_hierarchy = Array(0);