• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Controller/Import.php
  • Класс: BitrixImV2ControllerImport
  • Вызов: Import::getFolderIdAction
public function getFolderIdAction(int $chatId, CurrentUser $user): ?array
{
	$chat = Chat::getById($chatId, ['CHECK_ACCESS' => 'N']);
	if (!$chat)
	{
		$this->addError(new ChatError(ChatError::NOT_FOUND));

		return null;
	}

	if (!(new ImportService($chat, (int)$user->getId()))->hasAccess())
	{
		$this->addError(new ImportError(ImportError::ACCESS_ERROR));

		return null;
	}

	$folderId = CIMDisk::GetFolderModel($chatId)->getId();
	CIMDisk::ChangeFolderMembers($chatId, (int)$user->getId());

	return ['chatFolderId' => $folderId];
}