• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/document/documentcontroller.php
  • Класс: BitrixDiskDocumentDocumentController
  • Вызов: DocumentController::processBeforeAction
protected function processBeforeAction($actionName)
{
	if($actionName != 'start' && $this->request->getQuery('document_action') != 'start')
	{
		//todo hack. SocServ set backurl!
		if(mb_strpos($_SERVER['HTTP_REFERER'], 'tools/oauth') !== false)
		{
			$uri = CHTTP::urlDeleteParams($this->request->getRequestUri(), array("sessid", "document_action"));
			$uri = CHTTP::urlAddParams($uri, array('document_action' => 'start'));
			//restart process after authorization in social services
			LocalRedirect($uri);
		}
	}

	if($this->isActionWithExistsFile())
	{
		$this->initializeData();
		$this->checkReadPermissions();
	}

	if($actionName != 'start')
	{
		if(!$this->initializeDocumentService())
		{
			$this->sendJsonErrorResponse();
		}

		if(!$this->documentHandler->checkAccessibleTokenService())
		{
			$this->errorCollection->add(array(new Error(Loc::getMessage('DISK_DOC_CONTROLLER_ERROR_COULD_NOT_WORK_WITH_TOKEN_SERVICE_B24', array('#NAME#' => $this->documentHandler::getName())), self::ERROR_COULD_NOT_WORK_WITH_TOKEN_SERVICE)));
			$this->errorCollection->add($this->documentHandler->getErrors());
			$this->sendJsonErrorResponse();
		}

		if(!$this->documentHandler->queryAccessToken()->hasAccessToken() || $this->documentHandler->isRequiredAuthorization())
		{
			$this->sendNeedAuth();
		}
	}

	return true;
}