Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
extranet.php
1<?php
3
7
9{
15 public function onBeforeAction(Event $event): ?EventResult
16 {
17 $user = \CUser::getList(
18 'ID', 'ASC',
19 ['ID_EQUAL_EXACT' => \Bitrix\Landing\Manager::getUserId()],
20 ['FIELDS' => 'ID', 'SELECT' => ['UF_DEPARTMENT']]
21 )->fetch();
22
23 $isIntranet = ($user['UF_DEPARTMENT'][0] ?? 0) > 0;
24 if (!$isIntranet)
25 {
26 $this->addError(new Error('Extranet site is not allowed.', 'EXTRANET_IS_NOT_ALLOWED'));
27 return new EventResult(EventResult::ERROR, null, null, $this);
28 }
29
30 return null;
31 }
32}