mirror of https://github.com/sualko/cloud_bbb
feat: option to set everyone as moderator
parent
2624175af6
commit
d48c9da09c
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OCA\BigBlueButton\Migration;
|
||||
|
||||
use Closure;
|
||||
use OCP\DB\ISchemaWrapper;
|
||||
use OCP\Migration\IOutput;
|
||||
use OCP\Migration\SimpleMigrationStep;
|
||||
|
||||
class Version000000Date20200617055735 extends SimpleMigrationStep
|
||||
{
|
||||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @return null|ISchemaWrapper
|
||||
*/
|
||||
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options)
|
||||
{
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
|
||||
if ($schema->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;
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
});
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -21,6 +21,7 @@ export interface Room {
|
|||
record: boolean;
|
||||
access: Access;
|
||||
password?: string;
|
||||
everyoneIsModerator: boolean;
|
||||
}
|
||||
|
||||
export interface RoomShare {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<Props> = ({ room, updateProperty, open, setOpen }
|
|||
<h3>Moderator</h3>
|
||||
</label>
|
||||
|
||||
<ShareWith permission={Permission.Moderator} room={room} shares={shares} setShares={setShares} />
|
||||
{!room.everyoneIsModerator && <ShareWith permission={Permission.Moderator} room={room} shares={shares} setShares={setShares} />}
|
||||
|
||||
<div className="bbb-mt-1">
|
||||
<input id={`bbb-everyoneIsModerator-${room.id}`}
|
||||
type="checkbox"
|
||||
className="checkbox"
|
||||
checked={room.everyoneIsModerator}
|
||||
onChange={(event) => updateProperty('everyoneIsModerator', event.target.checked)} />
|
||||
<label htmlFor={`bbb-everyoneIsModerator-${room.id}`}>{t('bbb', 'Every participant is moderator')}</label>
|
||||
</div>
|
||||
<em>{descriptions.moderator}</em>
|
||||
</div>
|
||||
|
||||
<h3>{t('bbb', 'Miscellaneous')}</h3>
|
||||
|
|
Loading…
Reference in New Issue