diff options
author | Vitor Mattos <vitor@php.rio> | 2021-11-24 15:11:30 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2022-01-21 14:23:14 +0300 |
commit | c756413574a9dfc86770e166cdd50b838ef89be4 (patch) | |
tree | fd6ded7a32989f5c155e2c5bd15857c203c50d66 /lib/Service | |
parent | 764805f01787a19a5f19ac0f6c227f40fe449b68 (diff) |
Check share restrictions on one to one conversation
Signed-off-by: Vitor Mattos <vitor@php.rio>
Diffstat (limited to 'lib/Service')
-rw-r--r-- | lib/Service/RoomService.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Service/RoomService.php b/lib/Service/RoomService.php index f54544b18..5a8c45e1b 100644 --- a/lib/Service/RoomService.php +++ b/lib/Service/RoomService.php @@ -32,6 +32,7 @@ use OCA\Talk\Participant; use OCA\Talk\Room; use OCP\EventDispatcher\IEventDispatcher; use OCP\IUser; +use OCP\Share\IManager as IShareManager; class RoomService { @@ -39,14 +40,18 @@ class RoomService { protected $manager; /** @var ParticipantService */ protected $participantService; + /** @var IShareManager */ + protected $shareManager; /** @var IEventDispatcher */ private $dispatcher; public function __construct(Manager $manager, ParticipantService $participantService, + IShareManager $shareManager, IEventDispatcher $dispatcher) { $this->manager = $manager; $this->participantService = $participantService; + $this->shareManager = $shareManager; $this->dispatcher = $dispatcher; } @@ -66,6 +71,10 @@ class RoomService { $room = $this->manager->getOne2OneRoom($actor->getUID(), $targetUser->getUID()); $this->participantService->ensureOneToOneRoomIsFilled($room); } catch (RoomNotFoundException $e) { + if (!$this->shareManager->currentUserCanEnumerateTargetUser($actor, $targetUser)) { + throw new RoomNotFoundException(); + }; + $users = [$actor->getUID(), $targetUser->getUID()]; sort($users); $room = $this->manager->createRoom(Room::TYPE_ONE_TO_ONE, json_encode($users)); |