diff options
author | Daniel Rudolf <github.com@daniel-rudolf.de> | 2020-05-06 12:06:53 +0300 |
---|---|---|
committer | Daniel Rudolf <github.com@daniel-rudolf.de> | 2020-05-06 12:06:53 +0300 |
commit | 7cd525d8a621b79a2135ce49b8b8590909740281 (patch) | |
tree | 18d5fee38ecdda761589c42b5825eba73ada2ad1 /lib/Command | |
parent | e577601ae4a78391b0d8f220203138bc1e52e589 (diff) |
Proberly exclude one-to-one convos from talk:room:* commands
Signed-off-by: Daniel Rudolf <github.com@daniel-rudolf.de>
Diffstat (limited to 'lib/Command')
-rw-r--r-- | lib/Command/Room/Add.php | 6 | ||||
-rw-r--r-- | lib/Command/Room/Delete.php | 6 | ||||
-rw-r--r-- | lib/Command/Room/Demote.php | 6 | ||||
-rw-r--r-- | lib/Command/Room/ListCommand.php | 2 | ||||
-rw-r--r-- | lib/Command/Room/Promote.php | 6 | ||||
-rw-r--r-- | lib/Command/Room/Remove.php | 6 | ||||
-rw-r--r-- | lib/Command/Room/Update.php | 6 |
7 files changed, 37 insertions, 1 deletions
diff --git a/lib/Command/Room/Add.php b/lib/Command/Room/Add.php index d36959770..e9b1c8276 100644 --- a/lib/Command/Room/Add.php +++ b/lib/Command/Room/Add.php @@ -28,6 +28,7 @@ use Exception; use OC\Core\Command\Base; use OCA\Talk\Exceptions\RoomNotFoundException; use OCA\Talk\Manager; +use OCA\Talk\Room; use OCP\IConfig; use OCP\IUserManager; use Symfony\Component\Console\Input\InputArgument; @@ -77,6 +78,11 @@ class Add extends Base { return 1; } + if (!in_array($room->getType(), [Room::GROUP_CALL, Room::PUBLIC_CALL], true)) { + $output->writeln('<error>Room is no group call.</error>'); + return 1; + } + try { $this->addRoomParticipants($room, $users); } catch (Exception $e) { diff --git a/lib/Command/Room/Delete.php b/lib/Command/Room/Delete.php index f4c16f5f0..6c22a1544 100644 --- a/lib/Command/Room/Delete.php +++ b/lib/Command/Room/Delete.php @@ -27,6 +27,7 @@ namespace OCA\Talk\Command\Room; use OC\Core\Command\Base; use OCA\Talk\Exceptions\RoomNotFoundException; use OCA\Talk\Manager; +use OCA\Talk\Room; use OCP\IConfig; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -63,6 +64,11 @@ class Delete extends Base { return 1; } + if (!in_array($room->getType(), [Room::GROUP_CALL, Room::PUBLIC_CALL], true)) { + $output->writeln('<error>Room is no group call.</error>'); + return 1; + } + $room->deleteRoom(); $output->writeln('<info>Room successfully deleted.</info>'); diff --git a/lib/Command/Room/Demote.php b/lib/Command/Room/Demote.php index 3e75411a1..5169b6930 100644 --- a/lib/Command/Room/Demote.php +++ b/lib/Command/Room/Demote.php @@ -28,6 +28,7 @@ use Exception; use OC\Core\Command\Base; use OCA\Talk\Exceptions\RoomNotFoundException; use OCA\Talk\Manager; +use OCA\Talk\Room; use OCP\IConfig; use OCP\IUserManager; use Symfony\Component\Console\Input\InputArgument; @@ -77,6 +78,11 @@ class Demote extends Base { return 1; } + if (!in_array($room->getType(), [Room::GROUP_CALL, Room::PUBLIC_CALL], true)) { + $output->writeln('<error>Room is no group call.</error>'); + return 1; + } + try { $this->removeRoomModerators($room, $users); } catch (Exception $e) { diff --git a/lib/Command/Room/ListCommand.php b/lib/Command/Room/ListCommand.php index e580a83ed..be091a914 100644 --- a/lib/Command/Room/ListCommand.php +++ b/lib/Command/Room/ListCommand.php @@ -63,7 +63,7 @@ class ListCommand extends Base { $result = []; foreach ($this->manager->getRoomsForParticipant($userId) as $room) { - if ($room->getType() === Room::ONE_TO_ONE_CALL) { + if (!in_array($room->getType(), [Room::GROUP_CALL, Room::PUBLIC_CALL], true)) { continue; } diff --git a/lib/Command/Room/Promote.php b/lib/Command/Room/Promote.php index 2bc46f5ed..9fd647139 100644 --- a/lib/Command/Room/Promote.php +++ b/lib/Command/Room/Promote.php @@ -28,6 +28,7 @@ use Exception; use OC\Core\Command\Base; use OCA\Talk\Exceptions\RoomNotFoundException; use OCA\Talk\Manager; +use OCA\Talk\Room; use OCP\IConfig; use OCP\IUserManager; use Symfony\Component\Console\Input\InputArgument; @@ -77,6 +78,11 @@ class Promote extends Base { return 1; } + if (!in_array($room->getType(), [Room::GROUP_CALL, Room::PUBLIC_CALL], true)) { + $output->writeln('<error>Room is no group call.</error>'); + return 1; + } + try { $this->addRoomModerators($room, $users); } catch (Exception $e) { diff --git a/lib/Command/Room/Remove.php b/lib/Command/Room/Remove.php index 6ab0d0fdb..c7d15d0a7 100644 --- a/lib/Command/Room/Remove.php +++ b/lib/Command/Room/Remove.php @@ -28,6 +28,7 @@ use Exception; use OC\Core\Command\Base; use OCA\Talk\Exceptions\RoomNotFoundException; use OCA\Talk\Manager; +use OCA\Talk\Room; use OCP\IConfig; use OCP\IUserManager; use Symfony\Component\Console\Input\InputArgument; @@ -77,6 +78,11 @@ class Remove extends Base { return 1; } + if (!in_array($room->getType(), [Room::GROUP_CALL, Room::PUBLIC_CALL], true)) { + $output->writeln('<error>Room is no group call.</error>'); + return 1; + } + try { $this->removeRoomParticipants($room, $users); } catch (Exception $e) { diff --git a/lib/Command/Room/Update.php b/lib/Command/Room/Update.php index 1f7a8897b..6dee4da7c 100644 --- a/lib/Command/Room/Update.php +++ b/lib/Command/Room/Update.php @@ -28,6 +28,7 @@ use Exception; use OC\Core\Command\Base; use OCA\Talk\Exceptions\RoomNotFoundException; use OCA\Talk\Manager; +use OCA\Talk\Room; use OCP\IConfig; use OCP\IUserManager; use Symfony\Component\Console\Input\InputArgument; @@ -106,6 +107,11 @@ class Update extends Base { return 1; } + if (!in_array($room->getType(), [Room::GROUP_CALL, Room::PUBLIC_CALL], true)) { + $output->writeln('<error>Room is no group call.</error>'); + return 1; + } + try { if ($name !== null) { $this->setRoomName($room, $name); |