1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
AccessTrait.php
См. документацию.
1<?php
2
4
10
12{
13 protected static array $relations = [];
14
15 protected function getAccessManager(GroupModel $item, ?int $targetUserId, ?int $currentUserId): AccessManager
16 {
17 $group = $this->getEntityByModel($item);
18
19 $target = $this->getRelation($item->getId(), $targetUserId);
20 $current = $this->getRelation($item->getId(), $currentUserId);
21
22 return new AccessManager(
23 $group,
24 $target,
25 $current,
26 [],
27 [
28 'userId' => $currentUserId,
29 ]
30 );
31 }
32
33 protected function getEntityByModel(GroupModel $item): GroupEntity
34 {
36 }
37
38 protected function getRelation(int $groupId, ?int $userId): ?Member
39 {
40 if ($userId === null)
41 {
42 return null;
43 }
44
45 $key = $groupId . '_' . $userId;
46
47 if (!isset(self::$relations[$key]))
48 {
49 self::$relations[$key] = UserToGroupTable::query()
50 ->setSelect(['ID', 'ROLE', 'USER_ID', 'GROUP_ID', 'INITIATED_BY_TYPE', 'INITIATED_BY_USER_ID', 'AUTO_MEMBER'])
51 ->where('GROUP_ID', $groupId)
52 ->where('USER_ID', $userId)
53 ->fetchObject();
54 }
55
56 return self::$relations[$key];
57 }
58}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
static wakeUpObject(null|array|Arrayable $data)
Определения groupentity.php:14
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
getEntityByModel(GroupModel $item)
Определения AccessTrait.php:33
getAccessManager(GroupModel $item, ?int $targetUserId, ?int $currentUserId)
Определения AccessTrait.php:15
getRelation(int $groupId, ?int $userId)
Определения AccessTrait.php:38
if(empty($signedUserToken)) $key
Определения quickway.php:257