1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
AbstractModeFilter.php
См. документацию.
1<?php
2
4
10
11abstract class AbstractModeFilter implements FilterInterface
12{
13 protected bool $isSuperAdmin;
14
15 public function __construct(protected int $userId)
16 {
17 $currentUserId = User::getCurrentUserId();
18
19 $this->isSuperAdmin =
20 $currentUserId === $this->userId
21 && \CSocNetUser::IsCurrentUserModuleAdmin()
22 ;
23 }
24
25 abstract public function apply(Query $query): void;
26
28 {
29 $condition = Query::filter();
30
31 if (!$this->isSuperAdmin)
32 {
33 $condition
34 ->logic(ConditionTree::LOGIC_OR)
35 ->where($this->getParticipantCondition())
36 ->where($this->getRequestCondition())
37 ->where('VISIBLE', 'Y')
38 ;
39 }
40
41 return $condition;
42 }
43
45 {
46 return
47 Query::filter()
48 ->where('MEMBER.USER_ID', $this->userId)
49 ->where('MEMBER.ROLE', '<=' , UserToGroupTable::ROLE_USER)
50 ;
51 }
52
53 protected function getRequestCondition(): ConditionTree
54 {
55 return
56 Query::filter()
57 ->where('MEMBER.USER_ID', $this->userId)
58 ->where('MEMBER.ROLE', UserToGroupTable::ROLE_REQUEST)
59 ;
60 }
61}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
static getCurrentUserId()
Определения user.php:18
$query
Определения get_search.php:11
Определения chain.php:3