• Модуль: crmmobile
  • Путь к файлу: ~/bitrix/modules/crmmobile/lib/Controller/Category.php
  • Класс: BitrixCrmMobileControllerCategory
  • Вызов: Category::canViewItems
private function canViewItems(Factory $factory, int $categoryId): bool
{
	if ($factory->isCategoriesSupported())
	{
		$category = $factory->getCategory($categoryId);

		if (!$category)
		{
			$this->addError(ErrorCode::getNotFoundError());
			return false;
		}

		if (!Container::getInstance()->getUserPermissions()->canViewItemsInCategory($category))
		{
			$this->addError(ErrorCode::getAccessDeniedError());
			return false;
		}

		return true;
	}

	$canRead = Container::getInstance()
		->getUserPermissions()
		->checkReadPermissions($factory->getEntityTypeId(), 0, $categoryId)
	;

	if (!$canRead)
	{
		$this->addError(ErrorCode::getAccessDeniedError());
		return false;
	}

	return true;
}