diff options
author | Joas Schilling <coding@schilljs.com> | 2022-12-12 10:36:38 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2022-12-12 10:36:38 +0100 |
commit | 9a12cb255eb6eb1b0b01f345b34f2cbf70c36a02 (patch) | |
tree | cfbe3ff1f259ac44d635295df7bfde17e9fadea9 /lib/Config.php | |
parent | 9bdf2c17b073dfc563ec5c5c997b8252bfbcd204 (diff) |
Allow to define default permissions
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Config.php')
-rw-r--r-- | lib/Config.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Config.php b/lib/Config.php index 7e8728925..e153098ac 100644 --- a/lib/Config.php +++ b/lib/Config.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace OCA\Talk; use OCA\Talk\Events\GetTurnServersEvent; +use OCA\Talk\Model\Attendee; use OCA\Talk\Vendor\Firebase\JWT\JWT; use OCP\AppFramework\Utility\ITimeFactory; use OCP\EventDispatcher\IEventDispatcher; @@ -33,6 +34,7 @@ use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserManager; use OCP\Security\ISecureRandom; +use OCP\Server; class Config { public const SIGNALING_INTERNAL = 'internal'; @@ -172,6 +174,17 @@ class Config { return empty(array_intersect($allowedGroups, $userGroups)); } + public function getDefaultPermissions(): int { + // Admin configured default permissions + $configurableDefault = $this->config->getAppValue('spreed', 'default_permissions'); + if ($configurableDefault !== '') { + return (int) $configurableDefault; + } + + // Falling back to an unrestricted set of permissions, only ignoring the lobby is off + return Attendee::PERMISSIONS_MAX_DEFAULT & ~Attendee::PERMISSIONS_LOBBY_IGNORE; + } + public function getAttachmentFolder(string $userId): string { return $this->config->getUserValue($userId, 'spreed', 'attachment_folder', '/Talk'); } |