Index: branches/5.1.x/core/units/permissions/permissions_tag_processor.php =================================================================== diff -u -N -r13168 -r13545 --- branches/5.1.x/core/units/permissions/permissions_tag_processor.php (.../permissions_tag_processor.php) (revision 13168) +++ branches/5.1.x/core/units/permissions/permissions_tag_processor.php (.../permissions_tag_processor.php) (revision 13545) @@ -1,6 +1,6 @@ Application->recallObject('c'); + /* @var $category kDBItem */ $group_id = $this->Application->GetVar('group_id'); $prefix = $this->Application->GetVar('item_prefix'); @@ -103,20 +104,20 @@ $this_cat = array_pop($categories); // get permission name + category position in parent path that has value set for that permission - $case = 'MAX(CASE c.CategoryId'; + $case = 'MAX(CASE p.CatId'; foreach ($categories as $pos => $cat_id) { $case .= ' WHEN '.$cat_id.' THEN '.$pos; } $case .= ' END) AS InheritedPosition'; + $sql = 'SELECT '.$case.', p.Permission AS Perm - FROM '.TABLE_PREFIX.'Category c - LEFT JOIN '.$perm_live_table.' p ON p.CatId = c.CategoryId + FROM '.$perm_live_table.' p LEFT JOIN '.TABLE_PREFIX.'PermissionConfig pc ON pc.PermissionName = p.Permission WHERE - CategoryId IN ('.implode(',', $categories).') AND - ModuleId = "'.$module.'" AND + p.CatId IN ('.implode(',', $categories).') AND + pc.ModuleId = ' . $this->Conn->qstr($module) . ' AND ( - (p.GroupId = '.(int)$group_id.' AND p.Type = 0) + (p.GroupId = ' . (int)$group_id . ' AND p.Type = 0) ) GROUP BY Perm'; $perm_positions = $this->Conn->GetCol($sql, 'Perm');