Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/rest/lib/controller/configuration/ |
Upload File : |
<?php namespace Bitrix\Rest\Controller\Configuration; use Bitrix\Main\Engine\Controller; use Bitrix\Main\Engine\ActionFilter; use Bitrix\Rest\Engine\ActionFilter\AuthType; use Bitrix\Rest\Configuration\Action; use Bitrix\Rest\OAuth\Auth; use CRestServer; class Import extends Controller { /** * Registers import action * @param array $data * @param array $option * * @return array */ public function registerAction(array $data, array $option = [], CRestServer $server = null) { $import = new Action\Import(); $userId = 0; $appCode = ''; if ($server instanceof CRestServer && $server->getAuthType() === Auth::AUTH_TYPE) { $appCode = $server->getClientId(); $auth = $server->getAuthData(); if (!empty($auth['user_id'])) { $userId = (int)$auth['user_id']; } } if ($userId === 0) { global $USER; $userId = $USER->getId(); } return $import->register($data, $option, $userId, $appCode); } /** * Unregisters import action * @param $processId * * @return array */ public function unregisterAction($processId): array { $import = new Action\Import($processId); return $import->unregister(); } /** * Returns information about import * @param $processId * * @return array */ public function getAction($processId): array { $import = new Action\Import($processId); return $import->get(); } /** * @return array */ public function getDefaultPreFilters() { return [ new ActionFilter\Authentication(), new ActionFilter\Scope(ActionFilter\Scope::REST), new AuthType(AuthType::APPLICATION || AuthType::PASSWORD), ]; } }