1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
engine.php
См. документацию.
1<?php
8
9namespace Bitrix\Rest\OAuth;
10
11
12use Bitrix\Main\Config\Option;
13use Bitrix\Main;
14
15class Engine
16{
17 protected $scope = array(
18 "rest", "application"
19 );
20
21 protected $client = null;
22
23 public function __construct()
24 {
25 }
26
27
31 public function getClient()
32 {
33 if(!$this->client)
34 {
35 $this->client = new Client(
36 $this->getClientId(),
37 $this->getClientSecret(),
38 $this->getLicense()
39 );
40 }
41
42 return $this->client;
43 }
44
45 public function isRegistered()
46 {
47 return $this->getClientId() !== false;
48 }
49
50 public function getClientId()
51 {
52 return Option::get("rest", "service_client_id", false);
53 }
54
55 public function getClientSecret()
56 {
57 return Option::get("rest", "service_client_secret", false);
58 }
59
60 public function setAccess(array $accessParams)
61 {
62 $connection = Main\Application::getInstance()->getConnection();
63 $connection->startTransaction();
64 try
65 {
66 Option::set("rest", "service_client_id", $accessParams["client_id"]);
67 Option::set("rest", "service_client_secret", $accessParams["client_secret"]);
68 $connection->commitTransaction();
69 }
71 {
72 $connection->rollbackTransaction();
73 }
74
75 $this->client = null;
76 }
77
78 public function clearAccess()
79 {
80 $this->setAccess(array(
81 "client_id" => false,
82 "client_secret" => false,
83 ));
84
85 $this->client = null;
86 }
87
88 public function getLicense()
89 {
90 return LICENSE_KEY;
91 }
92}
$connection
Определения actionsdefinitions.php:38
static getInstance()
Определения application.php:98
__construct()
Определения engine.php:23
setAccess(array $accessParams)
Определения engine.php:60
getClientSecret()
Определения engine.php:55
getClient()
Определения engine.php:31
isRegistered()
Определения engine.php:45
clearAccess()
Определения engine.php:78
getClientId()
Определения engine.php:50
$client
Определения engine.php:21
getLicense()
Определения engine.php:88
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
const LICENSE_KEY($show_sql_stat=='Y')
Определения start.php:84
Определения action.php:3