CAllCrmActivity::CheckCompletePermission

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CAllCrmActivity
  4. CheckCompletePermission
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_activity.php
  • Класс: \CAllCrmActivity
  • Вызов: CAllCrmActivity::CheckCompletePermission
static function CheckCompletePermission($ownerType, $ownerID, $userPermissions = null, $params = null)
{
	$ownerTypeName = is_numeric($ownerType)
		? CCrmOwnerType::ResolveName((int)$ownerType)
		: mb_strtoupper(strval($ownerType));

	if(!is_int($ownerID))
	{
		$ownerID = (int)$ownerID;
	}

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

	if(is_array($params))
	{
		$ID = isset($params['ID']) ? $params['ID'] : 0;
		$fields = isset($params['FIELDS']) ? $params['FIELDS'] : null;
		if((!is_array($fields) || !isset($fields['TYPE_ID']) || !isset($fields['PROVIDER_ID']) )&& $ID > 0)
		{
			$fields = self::GetByID($ID, false);
		}

		if(is_array($fields))
		{
			$provider = self::GetActivityProvider($fields);
			if ($provider !== null)
			{
				$associatedEntityID = isset($fields['ASSOCIATED_ENTITY_ID']) ? (int)$fields['ASSOCIATED_ENTITY_ID'] : 0;
				$result = $provider::checkCompletePermission($associatedEntityID, $fields, $userPermissions->GetUserID());
				if (is_bool($result))
				{
					return $result;
				}
			}
		}
	}

	$permissionEntityType = CCrmPerms::ResolvePermissionEntityType($ownerTypeName, $ownerID);
	return CCrmAuthorizationHelper::CheckUpdatePermission($permissionEntityType, $ownerID, $userPermissions);
}

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