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
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-06-18 10:27:49 +0300
committerJoas Schilling <coding@schilljs.com>2020-06-29 16:50:20 +0300
commit9432b91b281416f15c626750ac1ba2d1033d49ff (patch)
tree6695c589a591549e70be91805e305348d28596df /lib/Service/RoomService.php
parent9357f4672de0425ee6b64c26d2fd535ab18021ac (diff)
Also validate the room type and add tests for the service
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Service/RoomService.php')
-rw-r--r--lib/Service/RoomService.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Service/RoomService.php b/lib/Service/RoomService.php
index ad6af03fc..2960cbaed 100644
--- a/lib/Service/RoomService.php
+++ b/lib/Service/RoomService.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020 Joas Schilling <coding@schilljs.com>
@@ -82,6 +83,14 @@ class RoomService {
throw new InvalidArgumentException('name');
}
+ if (!\in_array($type, [
+ Room::GROUP_CALL,
+ Room::PUBLIC_CALL,
+ Room::CHANGELOG_CONVERSATION,
+ ], true)) {
+ throw new InvalidArgumentException('type');
+ }
+
$room = $this->manager->createRoom($type, $name, $objectType, $objectId);
if ($owner instanceof IUser) {