• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/rest/service/baseobject.php
  • Класс: Bitrix\Disk\Rest\Service\BaseObject
  • Вызов: BaseObject::copyTo
protected function copyTo($id, $targetFolderId)
{
	$object = $this->getWorkObjectById($id);
	$targetFolder = $this->getFolderById($targetFolderId);

	$securityContext = $object->getStorage()->getCurrentUserSecurityContext();
	$targetSecurityContext = $targetFolder->getStorage()->getCurrentUserSecurityContext();
	if(!$object->canRead($securityContext) || !$targetFolder->canAdd($targetSecurityContext))
	{
		throw new AccessException;
	}

	$newFile = $object->copyTo($targetFolder, $this->userId);
	if(!$newFile)
	{
		$this->errorCollection->add($object->getErrors());
		return null;
	}

	return $newFile;
}