feat: add admin settings for default skip media

pull/176/head
Jonas 2021-08-18 09:45:30 +02:00
parent 1eced951e7
commit 75cd2475dd
3 changed files with 22 additions and 1 deletions

View File

@ -12,19 +12,25 @@ use OCA\BigBlueButton\Event\RoomDeletedEvent;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\MultipleObjectsReturnedException;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig;
class RoomService {
/** @var RoomMapper */
private $mapper;
/** @var IConfig */
private $config;
/** @var IEventDispatcher */
private $eventDispatcher;
public function __construct(
RoomMapper $mapper,
IConfig $config,
IEventDispatcher $eventDispatcher) {
$this->mapper = $mapper;
$this->config = $config;
$this->eventDispatcher = $eventDispatcher;
}
@ -76,6 +82,12 @@ class RoomService {
public function create(string $name, string $welcome, int $maxParticipants, bool $record, string $access, string $userId): \OCP\AppFramework\Db\Entity {
$room = new Room();
if($this->config->getAppValue('bbb', 'join.defaultMedia') === 'true') {
$media = false;
} else {
$media = true;
}
$room->setUid(\OC::$server->getSecureRandom()->generate(16, \OCP\Security\ISecureRandom::CHAR_HUMAN_READABLE));
$room->setName($name);
$room->setWelcome($welcome);
@ -86,7 +98,7 @@ class RoomService {
$room->setAccess($access);
$room->setUserId($userId);
$room->setListenOnly(true);
$room->setMediaCheck(true);
$room->setMediaCheck($media);
$room->setCleanLayout(false);
$room->setJoinMuted(false);

View File

@ -30,6 +30,7 @@ class Admin implements ISettings {
'app.navigation' => $this->config->getAppValue('bbb', 'app.navigation') === 'true' ? 'checked' : '',
'join.theme' => $this->config->getAppValue('bbb', 'join.theme') === 'true' ? 'checked' : '',
'app.shortener' => $this->config->getAppValue('bbb', 'app.shortener'),
'join.defaultMedia' => $this->config->getAppValue('bbb', 'join.defaultMedia') === 'true' ? 'checked' : '',
];
return new TemplateResponse('bbb', 'admin', $parameters);

View File

@ -29,6 +29,14 @@ script('bbb', 'restrictions');
<label for="bbb-join-theme"><?php p($l->t('Use Nextcloud theme in BigBlueButton.')); ?></label>
</p>
<h3><?php p($l->t('Default Room Settings')); ?></h3>
<p><?php p($l->t('Below you can change some default values, which are used to create a new room.')); ?></p>
<p>
<input type="checkbox" name="join.defaultMedia" id="bbb-join-defaultMedia" class="checkbox bbb-setting" value="1" <?php p($_['join.defaultMedia']); ?> />
<label for="bbb-join-defaultMedia"><?php p($l->t('Skip media check before usage')); ?></label>
</p>
<h3><?php p($l->t('Community')); ?></h3>
<p><?php p($l->t('Are you enjoying this app? Give something back to the open source community.')); ?> <a href="https://github.com/sualko/cloud_bbb/blob/master/.github/contributing.md" target="_blank" rel="noopener noreferrer" class="button"><span class="heart"></span> <?php p($l->t('Checkout the contributor guide')); ?></a></p>