Index: branches/5.1.x/core/units/categories/categories_tag_processor.php =================================================================== diff -u -N -r13452 -r13461 --- branches/5.1.x/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 13452) +++ branches/5.1.x/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 13461) @@ -1,6 +1,6 @@ Application->ParseBlock($params); } + + /** + * Returns list of categories, that have category add/edit permission + * + * @param Array $params + * @return string + */ + function AllowedCategoriesJSON($params) + { + if ($this->Application->RecallVar('user_id') == -1) { + $categories = true; + } + else { + $object =& $this->getObject($params); + /* @var $object kDBItem */ + + $perm_helper =& $this->Application->recallObject('PermissionsHelper'); + /* @var $perm_helper kPermissionsHelper */ + + $perm_prefix = $this->Application->getUnitOption($this->Prefix, 'PermItemPrefix'); + $categories = $perm_helper->getPermissionCategories($perm_prefix . '.' . ($object->IsNewItem() ? 'ADD' : 'MODIFY')); + } + + $json_helper =& $this->Application->recallObject('JSONHelper'); + /* @var $json_helper JSONHelper */ + + return $json_helper->encode($categories); + } } \ No newline at end of file