diff options
author | Joas Schilling <coding@schilljs.com> | 2020-05-15 16:00:03 +0300 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2020-07-01 14:11:39 +0300 |
commit | cb9eb665be4a9fa07c5649e3b65ee7d168b8671a (patch) | |
tree | 48b39cb9c9b25930dee15dd069fedc608e41d7e8 | |
parent | 6467e6b909401363b84daa4c632bce06e642e1b4 (diff) |
Also support guests to prevent breaking their sessions
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | lib/Controller/RoomController.php | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php index 4698dfa25..e09a54c25 100644 --- a/lib/Controller/RoomController.php +++ b/lib/Controller/RoomController.php @@ -1169,14 +1169,26 @@ class RoomController extends AEnvironmentAwareController { return new DataResponse([], Http::STATUS_NOT_FOUND); } - if ($force === false && $this->userId !== null) { - try { - $participant = $room->getParticipant($this->userId); - if ($participant->getSessionId() !== '0') { - return new DataResponse([], Http::STATUS_CONFLICT); + if ($force === false) { + if ($this->userId !== null) { + try { + $participant = $room->getParticipant($this->userId); + if ($participant->getSessionId() !== '0') { + return new DataResponse([], Http::STATUS_CONFLICT); + } + } catch (ParticipantNotFoundException $e) { + // All fine, carry on + } + } else { + $session = $this->session->getSessionForRoom($token); + try { + $participant = $room->getParticipantBySession($session); + if ($participant->getSessionId() !== '0') { + return new DataResponse([], Http::STATUS_CONFLICT); + } + } catch (ParticipantNotFoundException $e) { + // All fine, carry on } - } catch (ParticipantNotFoundException $e) { - // All fine, carry on } } |