Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
import.php
1<?php
2
4
10use CRestServer;
11
12class Import extends Controller
13{
21 public function registerAction(array $data, array $option = [], CRestServer $server = null)
22 {
23 $import = new Action\Import();
24 $userId = 0;
25 $appCode = '';
26 if ($server instanceof CRestServer && $server->getAuthType() === Auth::AUTH_TYPE)
27 {
28 $appCode = $server->getClientId();
29 $auth = $server->getAuthData();
30 if (!empty($auth['user_id']))
31 {
32 $userId = (int)$auth['user_id'];
33 }
34 }
35
36 if ($userId === 0)
37 {
38 global $USER;
39 $userId = $USER->getId();
40 }
41
42 return $import->register($data, $option, $userId, $appCode);
43 }
44
51 public function unregisterAction($processId): array
52 {
53 $import = new Action\Import($processId);
54 return $import->unregister();
55 }
56
63 public function getAction($processId): array
64 {
65 $import = new Action\Import($processId);
66 return $import->get();
67 }
68
72 public function getDefaultPreFilters()
73 {
74 return [
75 new ActionFilter\Authentication(),
76 new ActionFilter\Scope(ActionFilter\Scope::REST),
77 new AuthType(AuthType::APPLICATION || AuthType::PASSWORD),
78 ];
79 }
80}
registerAction(array $data, array $option=[], CRestServer $server=null)
Definition import.php:21