Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
accessauthprovider.php
1
<?php
2
3
namespace
Bitrix\Main\Access\Auth
;
4
5
use
Bitrix\Main\Application
;
6
use
Bitrix\Main\Access\AccessCode
;
7
8
class
AccessAuthProvider
extends
\CAuthProvider
9
{
10
protected
const
PROVIDER_ID
=
'access'
;
11
12
public
static
function
GetProviders
()
13
{
14
return
[
15
[
16
"ID"
=>
self::PROVIDER_ID
,
17
"CLASS"
=> self::class,
18
]
19
];
20
}
21
22
public
function
__construct
()
23
{
24
$this->
id
=
self::PROVIDER_ID
;
25
}
26
27
public
function
UpdateCodes
($userId)
28
{
29
global $DB;
30
31
$iblockId = \COption::GetOptionInt(
'intranet'
,
'iblock_structure'
);
32
if
($iblockId > 0)
33
{
34
$tableName =
"b_uts_iblock_"
. $iblockId .
"_section"
;
35
36
if
(!$DB->TableExists($tableName))
37
{
38
return
null
;
39
}
40
41
$res = $DB->query(
"
42
SELECT VALUE_ID
43
FROM "
. $tableName .
"
44
WHERE UF_HEAD = "
. $userId
45
);
46
47
$connection =
Application::getConnection
();
48
$helper = $connection->getSqlHelper();
49
50
while
($row = $res->fetch())
51
{
52
$id = (int) $row[
'VALUE_ID'
];
53
54
$sql = $helper->getInsertIgnore(
55
'b_user_access'
,
56
'(USER_ID, PROVIDER_ID, ACCESS_CODE)'
,
57
'VALUES
58
('
.$userId.
',"'
.$this->id.
'","'
.
AccessCode::ACCESS_DIRECTOR
.
'0"),
59
('
.$userId.
',"'
.$this->id.
'","'
.
AccessCode::ACCESS_DIRECTOR
.$id.
'")'
60
);
61
$DB->query($sql);
62
}
63
}
64
}
65
}
Bitrix\Main\Access\AccessCode
Definition
accesscode.php:13
Bitrix\Main\Access\AccessCode\ACCESS_DIRECTOR
const ACCESS_DIRECTOR
Definition
accesscode.php:15
Bitrix\Main\Access\Auth\AccessAuthProvider
Definition
accessauthprovider.php:9
Bitrix\Main\Access\Auth\AccessAuthProvider\__construct
__construct()
Definition
accessauthprovider.php:22
Bitrix\Main\Access\Auth\AccessAuthProvider\UpdateCodes
UpdateCodes($userId)
Definition
accessauthprovider.php:27
Bitrix\Main\Access\Auth\AccessAuthProvider\GetProviders
static GetProviders()
Definition
accessauthprovider.php:12
Bitrix\Main\Access\Auth\AccessAuthProvider\PROVIDER_ID
const PROVIDER_ID
Definition
accessauthprovider.php:10
Bitrix\Main\Application
Definition
application.php:28
Bitrix\Main\Application\getConnection
static getConnection($name="")
Definition
application.php:611
Bitrix\Main\Access\Auth
Definition
accessauthprovider.php:3
modules
main
lib
access
auth
accessauthprovider.php
Создано системой
1.10.0