1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
ExternalChatRelations.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Im\V2\Relation;
4
5
use Bitrix\Im\V2\Chat\ExternalChat;
6
use Bitrix\Im\V2\Chat\ExternalChat\Event\FilterUsersByAccessEvent;
7
8
class
ExternalChatRelations
extends
ChatRelations
9
{
10
protected
const
NEED_ADDITIONAL_FILTER_BY_ACCESS
=
true
;
11
12
public
function
filterUserIdsByAccess
(
array
$userIds):
array
13
{
14
$chat = ExternalChat::getInstance($this->chatId);
15
if
(!$chat instanceof
ExternalChat
)
16
{
17
return
$userIds;
18
}
19
20
$event
=
new
FilterUsersByAccessEvent
($chat, $userIds);
21
$event
->send();
22
if
(!
$event
->hasResult())
23
{
24
return
$userIds;
25
}
26
27
$result
=
$event
->getResult();
28
$usersWithAccess =
$result
->getResult()[
'userIds'
] ?? [];
29
self::deleteUsersWithoutAccess($this->chatId, $userIds, $usersWithAccess);
30
31
return
$usersWithAccess;
32
}
33
34
private
static
function
deleteUsersWithoutAccess(
int
$chatId
,
array
$userIds,
array
$usersWithAccess): void
35
{
36
$cleaner =
LazyCleaner::getInstance
();
37
if
(!$cleaner->canMarkForDeletion())
38
{
39
return
;
40
}
41
42
$toDelete = array_diff($userIds, $usersWithAccess);
43
44
foreach
($toDelete as
$userId
)
45
{
46
$canMark =
LazyCleaner::getInstance
()->markForDeletion(
$chatId
,
$userId
);
47
if
(!$canMark)
48
{
49
break
;
50
}
51
}
52
}
53
}
$userId
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения
check_mail.php:18
Bitrix\Im\V2\Chat\ExternalChat\Event\FilterUsersByAccessEvent
Определения
FilterUsersByAccessEvent.php:8
Bitrix\Im\V2\Relation\ChatRelations
Определения
ChatRelations.php:10
Bitrix\Im\V2\Relation\ChatRelations\$chatId
int $chatId
Определения
ChatRelations.php:18
Bitrix\Im\V2\Relation\ExternalChatRelations
Определения
ExternalChatRelations.php:9
Bitrix\Im\V2\Relation\ExternalChatRelations\NEED_ADDITIONAL_FILTER_BY_ACCESS
const NEED_ADDITIONAL_FILTER_BY_ACCESS
Определения
ExternalChatRelations.php:10
Bitrix\Im\V2\Relation\ExternalChatRelations\filterUserIdsByAccess
filterUserIdsByAccess(array $userIds)
Определения
ExternalChatRelations.php:12
Bitrix\Im\V2\Relation\LazyCleaner\getInstance
static getInstance()
Определения
LazyCleaner.php:22
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
Bitrix\Im\V2\Chat\ExternalChat
Определения
Config.php:3
$event
$event
Определения
prolog_after.php:141
bitrix
modules
im
lib
V2
Relation
ExternalChatRelations.php
Создано системой
1.14.0