Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-05-15 15:57:23 +0300
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2020-07-01 14:11:39 +0300
commita1578c9184327455ff076c08e36d0581f9cc4495 (patch)
tree35b5603c1abde728895df5b40bd8031cd826ec03 /lib
parent145c9b4eb3377eb98aaf5dbe0bf627364d232159 (diff)
Optionally return 409 when trying to join a second time
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Controller/RoomController.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php
index ae071a028..4698dfa25 100644
--- a/lib/Controller/RoomController.php
+++ b/lib/Controller/RoomController.php
@@ -1159,15 +1159,27 @@ class RoomController extends AEnvironmentAwareController {
*
* @param string $token
* @param string $password
+ * @param bool $force
* @return DataResponse
*/
- public function joinRoom(string $token, string $password = ''): DataResponse {
+ public function joinRoom(string $token, string $password = '', bool $force = true): DataResponse {
try {
$room = $this->manager->getRoomForParticipantByToken($token, $this->userId);
} catch (RoomNotFoundException $e) {
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);
+ }
+ } catch (ParticipantNotFoundException $e) {
+ // All fine, carry on
+ }
+ }
+
$user = $this->userManager->get($this->userId);
try {
$result = $room->verifyPassword((string) $this->session->getPasswordForRoom($token));