CAllCrmActivity::CheckItemDeletePermission

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CAllCrmActivity
  4. CheckItemDeletePermission
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_activity.php
  • Класс: \CAllCrmActivity
  • Вызов: CAllCrmActivity::CheckItemDeletePermission
static function CheckItemDeletePermission(array $fields, $userPermissions = null)
{
	$ID = isset($fields['ID']) ? (int)$fields['ID'] : 0;
	if($ID <=  0)
	{
		return false;
	}

	$bindings = self::GetBindings($ID);
	if(is_array($bindings) && !empty($bindings))
	{
		foreach($bindings as &$binding)
		{
			if(!self::CheckDeletePermission($binding['OWNER_TYPE_ID'], $binding['OWNER_ID'], $userPermissions))
			{
				return false;
			}
		}
		unset($binding);
		return true;
	}

	$ownerTypeID = isset($fields['OWNER_TYPE_ID']) ? (int)$fields['OWNER_TYPE_ID'] : CCrmOwnerType::Undefined;
	$ownerID = isset($fields['OWNER_ID']) ? (int)$fields['OWNER_ID'] : 0;

	return $ownerID > 0
		&& CCrmOwnerType::IsDefined($ownerTypeID)
		&& self::CheckDeletePermission($ownerTypeID, $ownerID, $userPermissions);
}

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