1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
logright.php
См. документацию.
1<?php
8namespace Bitrix\Socialnetwork\Item;
9
10use Bitrix\Main\UserAccessTable;
11use Bitrix\Socialnetwork\LogRightTable;
12
14{
15 public static function get(int $logId = 0)
16 {
17 static $cache = [];
18
19 if ($logId <= 0)
20 {
21 return [];
22 }
23
24 if (!empty($cache[$logId]))
25 {
26 return $cache[$logId];
27 }
28
29 $result = [];
30
31 $res = LogRightTable::getList([
32 'filter' => [
33 '=LOG_ID' => $logId
34 ],
35 'select' => [ 'GROUP_CODE' ]
36 ]);
37 while ($logRightFields = $res->fetch())
38 {
39 $result[] = $logRightFields['GROUP_CODE'];
40 }
41
42 $cache[$logId] = $result;
43
44 return $result;
45 }
46
47 public static function getUserIdsByLogRights(array $logRights): array
48 {
49 //todo perfomance
50 if (!in_array('G2', $logRights, true) && in_array('AU', $logRights, true))
51 {
52 $logRights[] = 'G2';
53 }
54
55 $result = [];
56 $queryResult = UserAccessTable::query()
57 ->setDistinct()
58 ->setSelect([
59 'ID' => 'USER_ID',
60 ])
61 ->whereIn('ACCESS_CODE', $logRights)
62 ->exec()
63 ;
64
65 while ($item = $queryResult->fetch())
66 {
67 if ((int)$item['ID'] > 0)
68 {
69 $result[] = (int)$item['ID'];
70 }
71 }
72
73 return $result;
74 }
75
76 public static function OnAfterLogUpdate(\Bitrix\Main\Entity\Event $event)
77 {
78 $primary = $event->getParameter('primary');
79 $logId = (!empty($primary['ID']) ? intval($primary['ID']) : 0);
80 $fields = $event->getParameter('fields');
81
82 if (
83 $logId > 0
84 && !empty($fields)
85 && !empty($fields['LOG_UPDATE'])
86 )
87 {
89 'logId' => $logId,
90 'value' => $fields['LOG_UPDATE']
91 ));
92 }
93 }
94}
Определения event.php:5
static getUserIdsByLogRights(array $logRights)
Определения logright.php:47
static OnAfterLogUpdate(\Bitrix\Main\Entity\Event $event)
Определения logright.php:76
static setLogUpdate($params=array())
Определения logright.php:64
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$res
Определения filter_act.php:7
$result
Определения get_property_values.php:14
Определения ufield.php:9
$event
Определения prolog_after.php:141
$fields
Определения yandex_run.php:501