• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/uf/controller.php
  • Класс: BitrixDiskUfController
  • Вызов: Controller::getAttachedModel
protected function getAttachedModel()
{
	$this->checkRequiredGetParams(array(
		'attachedId',
	));
	if($this->errorCollection->hasErrors())
	{
		$this->sendJsonErrorResponse();
	}
	/** @var AttachedObject $attachedModel */
	$attachedModel = AttachedObject::loadById((int)$this->request->getQuery('attachedId'), array('OBJECT', 'VERSION'));
	if(!$attachedModel)
	{
		$this->errorCollection->add(array(new Error('Could not find attached object')));
		$this->sendJsonErrorResponse();
	}

	if(!$attachedModel->canRead($this->getUser()->getId()))
	{
		$this->errorCollection->add(array(new Error("Bad permission. Could not read this file")));
		$this->sendJsonErrorResponse();
	}

	return $attachedModel;
}