diff options
author | Vincent Petry <vincent@nextcloud.com> | 2020-12-02 17:39:35 +0300 |
---|---|---|
committer | Vincent Petry <vincent@nextcloud.com> | 2020-12-11 20:15:48 +0300 |
commit | 6f8d1e6529ec295c81c7ae2cda327a9e6a6852bc (patch) | |
tree | 46b47319375ee67d9ca6d44848d3537327f9c1f4 /lib/Service | |
parent | fddac323b5d9542baa79c58796a23d8a4dfe9951 (diff) |
Make it possible to join listed group conversations
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'lib/Service')
-rw-r--r-- | lib/Service/ParticipantService.php | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/lib/Service/ParticipantService.php b/lib/Service/ParticipantService.php index d5d59827d..04ee1f27f 100644 --- a/lib/Service/ParticipantService.php +++ b/lib/Service/ParticipantService.php @@ -166,12 +166,32 @@ class ParticipantService { throw new InvalidPasswordException('Provided password is invalid'); } - // User joining a public room, without being invited - $this->addUsers($room, [[ - 'actorType' => Attendee::ACTOR_USERS, - 'actorId' => $user->getUID(), - 'participantType' => Participant::USER_SELF_JOINED, - ]]); + // User joining a group call through listing + if ( + $room->getType() === Room::GROUP_CALL && ( + // this check should have happened earlier already but let's stay defensive + $room->getListable() === Room::LISTABLE_ALL || ( + $room->getListable() === Room::LISTABLE_USERS && !$this->manager->isGuestUser() + ) + ) + ) { + $this->addUsers($room, [[ + 'actorType' => Attendee::ACTOR_USERS, + 'actorId' => $user->getUID(), + // need to use "USER" here, because "USER_SELF_JOINED" only works for public calls + 'participantType' => Participant::USER, + ]]); + } elseif ($room->getType() === Room::PUBLIC_CALL) { + // User joining a public room, without being invited + $this->addUsers($room, [[ + 'actorType' => Attendee::ACTOR_USERS, + 'actorId' => $user->getUID(), + 'participantType' => Participant::USER_SELF_JOINED, + ]]); + } else { + // shouldn't happen unless some code called joinRoom without previous checks + throw new UnauthorizedException('Participant is not allowed to join'); + } $attendee = $this->attendeeMapper->findByActor($room->getId(), Attendee::ACTOR_USERS, $user->getUID()); } |