1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
engine.php
См. документацию.
1
<?php
8
9
namespace
Bitrix\Rest\OAuth;
10
11
12
use Bitrix\Main\Config\Option;
13
use Bitrix\Main;
14
15
class
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
}
70
catch
(
Main
\
ArgumentNullException
$e)
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
$connection
Определения
actionsdefinitions.php:38
Bitrix\Main\Application\getInstance
static getInstance()
Определения
application.php:98
Bitrix\Main\ArgumentNullException
Определения
ArgumentNullException.php:9
Bitrix\Rest\OAuth\Client
Определения
client.php:33
Bitrix\Rest\OAuth\Engine\__construct
__construct()
Определения
engine.php:23
Bitrix\Rest\OAuth\Engine\setAccess
setAccess(array $accessParams)
Определения
engine.php:60
Bitrix\Rest\OAuth\Engine\getClientSecret
getClientSecret()
Определения
engine.php:55
Bitrix\Rest\OAuth\Engine\$scope
$scope
Определения
engine.php:17
Bitrix\Rest\OAuth\Engine\getClient
getClient()
Определения
engine.php:31
Bitrix\Rest\OAuth\Engine\isRegistered
isRegistered()
Определения
engine.php:45
Bitrix\Rest\OAuth\Engine\clearAccess
clearAccess()
Определения
engine.php:78
Bitrix\Rest\OAuth\Engine\getClientId
getClientId()
Определения
engine.php:50
Bitrix\Rest\OAuth\Engine\$client
$client
Определения
engine.php:21
Bitrix\Rest\OAuth\Engine\getLicense
getLicense()
Определения
engine.php:88
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
LICENSE_KEY
const LICENSE_KEY($show_sql_stat=='Y')
Определения
start.php:84
Bitrix\Main\Engine
Определения
action.php:3
Bitrix\Main
bitrix
modules
rest
lib
oauth
engine.php
Создано системой
1.14.0