diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php index edd2b3b..b51a9d6 100644 --- a/lib/Controller/RoomController.php +++ b/lib/Controller/RoomController.php @@ -74,10 +74,11 @@ class RoomController extends Controller string $welcome, int $maxParticipants, bool $record, - string $access + string $access, + bool $everyoneIsModerator ): DataResponse { - return $this->handleNotFound(function () use ($id, $name, $welcome, $maxParticipants, $record, $access) { - return $this->service->update($id, $name, $welcome, $maxParticipants, $record, $access, $this->userId); + return $this->handleNotFound(function () use ($id, $name, $welcome, $maxParticipants, $record, $everyoneIsModerator, $access) { + return $this->service->update($id, $name, $welcome, $maxParticipants, $record, $access, $everyoneIsModerator, $this->userId); }); } diff --git a/lib/Db/Room.php b/lib/Db/Room.php index 25eddb5..e2f5340 100644 --- a/lib/Db/Room.php +++ b/lib/Db/Room.php @@ -23,24 +23,27 @@ class Room extends Entity implements JsonSerializable public $userId; public $access; public $password; + public $everyoneIsModerator; public function __construct() { $this->addType('maxParticipants', 'integer'); $this->addType('record', 'boolean'); + $this->addType('everyoneIsModerator', 'boolean'); } public function jsonSerialize(): array { return [ - 'id' => $this->id, - 'uid' => $this->uid, - 'name' => $this->name, - 'welcome' => $this->welcome, - 'maxParticipants' => (int) $this->maxParticipants, - 'record' => boolval($this->record), - 'access' => $this->access, - 'password' => $this->password, + 'id' => $this->id, + 'uid' => $this->uid, + 'name' => $this->name, + 'welcome' => $this->welcome, + 'maxParticipants' => (int) $this->maxParticipants, + 'record' => boolval($this->record), + 'access' => $this->access, + 'password' => $this->password, + 'everyoneIsModerator' => boolval($this->everyoneIsModerator), ]; } } diff --git a/lib/Migration/Version000000Date20200617055735.php b/lib/Migration/Version000000Date20200617055735.php new file mode 100644 index 0000000..d722b89 --- /dev/null +++ b/lib/Migration/Version000000Date20200617055735.php @@ -0,0 +1,41 @@ +hasTable('bbb_rooms')) { + $table = $schema->getTable('bbb_rooms'); + + if (!$table->hasColumn('everyone_is_moderator')) { + $table->addColumn('everyone_is_moderator', 'boolean', [ + 'notnull' => true, + 'default' => false, + ]); + } + + return $schema; + } + + return null; + } +} diff --git a/lib/Permission.php b/lib/Permission.php index 28aeb7d..ae7a04c 100644 --- a/lib/Permission.php +++ b/lib/Permission.php @@ -34,6 +34,10 @@ class Permission public function isModerator(Room $room, string $uid) { + if ($room->everyoneIsModerator) { + return true; + } + return $this->hasPermission($room, $uid, function (RoomShare $share) { return $share->hasModeratorPermission(); }); diff --git a/lib/Service/RoomService.php b/lib/Service/RoomService.php index ff3fe74..6bcf573 100644 --- a/lib/Service/RoomService.php +++ b/lib/Service/RoomService.php @@ -75,7 +75,7 @@ class RoomService return $this->mapper->insert($room); } - public function update($id, $name, $welcome, $maxParticipants, $record, $access, $userId) + public function update($id, $name, $welcome, $maxParticipants, $record, $access, $everyoneIsModerator, $userId) { try { $room = $this->mapper->find($id, $userId); @@ -89,6 +89,7 @@ class RoomService $room->setMaxParticipants($maxParticipants); $room->setRecord($record); $room->setAccess($access); + $room->setEveryoneIsModerator($everyoneIsModerator); $room->setUserId($userId); return $this->mapper->update($room); diff --git a/ts/Manager/Api.ts b/ts/Manager/Api.ts index b662f48..b2e1010 100644 --- a/ts/Manager/Api.ts +++ b/ts/Manager/Api.ts @@ -21,6 +21,7 @@ export interface Room { record: boolean; access: Access; password?: string; + everyoneIsModerator: boolean; } export interface RoomShare { diff --git a/ts/Manager/App.scss b/ts/Manager/App.scss index 118b017..17cb916 100644 --- a/ts/Manager/App.scss +++ b/ts/Manager/App.scss @@ -7,6 +7,14 @@ margin-top: 25px; } +.bbb-mb-1 { + margin-bottom: 1em; +} + +.bbb-mt-1 { + margin-top: 1em; +} + #bbb-warning { padding: 1em; background-color: rgb(255, 255, 123); diff --git a/ts/Manager/EditRoomDialog.tsx b/ts/Manager/EditRoomDialog.tsx index 478a7fb..2b74e50 100644 --- a/ts/Manager/EditRoomDialog.tsx +++ b/ts/Manager/EditRoomDialog.tsx @@ -10,6 +10,7 @@ const descriptions: { [key: string]: string } = { maxParticipants: t('bbb', 'Sets a limit on the number of participants for this room. Zero means there is no limit.'), recording: t('bbb', 'If enabled, the moderator is able to start the recording.'), access: t('bbb', 'Public: Everyone knowing the link is able to join. Password: Guests have to provide a password. Waiting room: A moderator has to accept every guest before they can join. Internal: Only Nextcloud users can join.'), + moderator: t('bbb', 'A moderator is able to manage all participants in a meeting including kicking, muting or selecting a presenter. Users with the role moderator are also able to close a meeting or change the default settings.'), }; type Props = { @@ -96,7 +97,17 @@ const EditRoomDialog: React.FC = ({ room, updateProperty, open, setOpen }

Moderator

- + {!room.everyoneIsModerator && } + +
+ updateProperty('everyoneIsModerator', event.target.checked)} /> + +
+ {descriptions.moderator}

{t('bbb', 'Miscellaneous')}