1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
UserExtranet.php
См. документацию.
1<?php
2
3namespace Bitrix\Im\V2\Entity\User;
4
5use Bitrix\Im\Integration\Socialnetwork\Extranet;
6use Bitrix\Im\V2\Chat\ChatError;
7use Bitrix\Im\V2\Result;
8
9class UserExtranet extends User
10{
11 protected function checkAccessInternal(User $otherUser): Result
12 {
13 $result = new Result();
14
15 if (!static::$moduleManager::isModuleInstalled('intranet'))
16 {
17 if (!$this->hasAccessBySocialNetwork($otherUser->getId()))
18 {
20 }
21
22 return $result;
23 }
24
25 if ($otherUser->isBot())
26 {
27 return $result;
28 }
29
30 if ($this->isNetwork() && !$otherUser->isExtranet())
31 {
32 return $result;
33 }
34
35 $inGroup = Extranet::isUserInGroup(
36 $this->getId(),
37 $otherUser->getId(),
38 false
39 );
40
41 if ($inGroup)
42 {
43 return $result;
44 }
45
46 return $result->addError(new ChatError(ChatError::ACCESS_DENIED));
47 }
48
49 public function getType(): UserType
50 {
51 return UserType::EXTRANET;
52 }
53}
static isUserInGroup($userId, $currentUserId=null, bool $filterActiveUser=true)
Определения extranet.php:112
const ACCESS_DENIED
Определения ChatError.php:19
checkAccessInternal(User $otherUser)
Определения UserExtranet.php:11
hasAccessBySocialNetwork(int $idOtherUser)
Определения User.php:241
isNetwork()
Определения User.php:551
isExtranet()
Определения User.php:531
Определения result.php:20
$result
Определения get_property_values.php:14