• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/controller/onlyoffice.php
  • Класс: BitrixDiskControllerOnlyOffice
  • Вызов: OnlyOffice::loadDocumentViewerAction
public function loadDocumentViewerAction(
	DiskFile $object = null,
	DiskVersion $version = null,
	DiskAttachedObject $attachedObject = null,
	int $editorMode = DocumentOnlyOfficeEditorConfigBuilder::VISUAL_MODE_USUAL
): ?HttpResponse
{
	if ($object && $version && $object->getId() != $version->getObjectId())
	{
		$object = null;
	}

	if ($object === null && $version)
	{
		$object = $version->getObject();
	}

	$canRead = false;
	if ($attachedObject && !$attachedObject->canRead(User::resolveUserId($this->getCurrentUser())))
	{
		$attachedObject = null;
	}
	elseif ($attachedObject)
	{
		$canRead = true;
	}

	if ($object && $attachedObject && ($object->getId() != $attachedObject->getObjectId()))
	{
		$object = null;
	}

	if ($object && !$canRead)
	{
		$securityContext = $object->getStorage()->getCurrentUserSecurityContext();
		if ($object->canRead($securityContext))
		{
			$canRead = true;
		}
	}

	if (!$canRead)
	{
		return $this->showNotFoundPageAction();
	}

	return $this->loadDocumentEditor($object, $version, $attachedObject, ModelsDocumentSession::TYPE_VIEW, $editorMode);
}