• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/controller/call.php
  • Класс: BitrixImControllerCall
  • Вызов: Call::getUsersAction
public function getUsersAction($callId, array $userIds = [])
{
	$currentUserId = $this->getCurrentUser()->getId();
	$call = Registry::getCallWithId($callId);
	if (!$call)
	{
		$this->addError(new Error(Loc::getMessage("IM_REST_CALL_ERROR_CALL_NOT_FOUND"), "call_not_found"));
		return null;
	}

	if(!$this->checkCallAccess($call, $currentUserId))
	{
		$this->errorCollection[] = new Error("You do not have access to the call", "access_denied");
		return null;
	}
	if (empty($userIds))
	{
		$allowedUserIds = $call->getUsers();
	}
	else
	{
		$allowedUserIds = array_filter($userIds, function($userId) use ($call, $currentUserId)
		{
			return $userId == $currentUserId || $call->hasUser($userId);
		});
	}

	if (empty($allowedUserIds))
	{
		$this->errorCollection[] = new Error("Users are not part of the call", "access_denied");
		return null;
	}

	return Util::getUsers($allowedUserIds);
}