CAllCrmDeal::GetPermittedCategoryIDs

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CAllCrmDeal
  4. GetPermittedCategoryIDs
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_deal.php
  • Класс: \CAllCrmDeal
  • Вызов: CAllCrmDeal::GetPermittedCategoryIDs
static function GetPermittedCategoryIDs($permissionType, CCrmPerms $userPermissions = null)
{
	if(!($userPermissions instanceof CCrmPerms))
	{
		$userPermissions = CCrmPerms::GetCurrentUserPermissions();
	}

	$categoryIDs = array();
	$allCategoryIDs = DealCategory::getAllIDs();
	foreach($allCategoryIDs as $categoryID)
	{
		$permissionEntity = DealCategory::convertToPermissionEntityType($categoryID);
		if($permissionType === 'CREATE')
		{
			$result = CCrmAuthorizationHelper::CheckCreatePermission($permissionEntity, $userPermissions);
		}
		elseif($permissionType === 'UPDATE')
		{
			$result = CCrmAuthorizationHelper::CheckUpdatePermission($permissionEntity, 0, $userPermissions);
		}
		else
		{
			$result = CCrmAuthorizationHelper::CheckReadPermission($permissionEntity, 0, $userPermissions);
		}

		if($result)
		{
			$categoryIDs[] = $categoryID;
		}
	}
	return $categoryIDs;
}

Добавить комментарий