CCrmAuthorizationHelper::CheckDeletePermission

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmAuthorizationHelper
  4. CheckDeletePermission
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_authorization_helper.php
  • Класс: \CCrmAuthorizationHelper
  • Вызов: CCrmAuthorizationHelper::CheckDeletePermission
static function CheckDeletePermission($entityTypeName, $entityID, $userPermissions = null, $entityAttrs = null)
{
	$entityTypeName = strval($entityTypeName);
	$entityID = intval($entityID);

	if(!$userPermissions)
	{
		$userPermissions = self::GetUserPermissions();
	}

	if (\Bitrix\Crm\Service\Container::getInstance()->getUserPermissions($userPermissions->GetUserID())->isAdmin())
	{
		return true;
	}

	if($entityID <= 0)
	{
		return !$userPermissions->HavePerm($entityTypeName, BX_CRM_PERM_NONE, 'DELETE');
	}

	if(!is_array($entityAttrs))
	{
		$entityAttrs = $userPermissions->GetEntityAttr($entityTypeName, $entityID);
	}

	return !$userPermissions->HavePerm($entityTypeName, BX_CRM_PERM_NONE, 'DELETE')
		&& $userPermissions->CheckEnityAccess($entityTypeName, 'DELETE', isset($entityAttrs[$entityID]) ? $entityAttrs[$entityID] : array());
}

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