summaryrefslogtreecommitdiffstats
path: root/lib/Config.php
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2024-01-31 12:46:16 +0100
committerJoas Schilling <coding@schilljs.com>2024-02-12 16:54:15 +0100
commit7412cf4c67942cfa1c07e917804a7a4fd5208041 (patch)
tree3779eb5abcc4ad67a61e0ba6ab69ff235f11b219 /lib/Config.php
parent9dc0ff02198dfdcdb5061b2630f3363d9dec7c03 (diff)
feat(federation): Add appconfig options to restrict federation
- Incoming federation - Outgoing federation - Group list - Limit federation to trusted servers Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Config.php')
-rw-r--r--lib/Config.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Config.php b/lib/Config.php
index b5258674d..9de026af9 100644
--- a/lib/Config.php
+++ b/lib/Config.php
@@ -27,6 +27,7 @@ use OCA\Talk\Events\BeforeTurnServersGetEvent;
use OCA\Talk\Model\Attendee;
use OCA\Talk\Service\RecordingService;
use OCA\Talk\Vendor\Firebase\JWT\JWT;
+use OCP\AppFramework\Services\IAppConfig;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IConfig;
@@ -56,6 +57,7 @@ class Config {
public function __construct(
protected IConfig $config,
+ protected IAppConfig $appConfig,
private ISecureRandom $secureRandom,
private IGroupManager $groupManager,
private IUserManager $userManager,
@@ -111,6 +113,16 @@ class Config {
return $this->config->getAppValue('spreed', 'federation_enabled', 'no') === 'yes';
}
+ public function isFederationEnabledForUserId(IUser $user): bool {
+ $allowedGroups = $this->appConfig->getAppValueArray('federation_allowed_groups', lazy: true);
+ if (empty($allowedGroups)) {
+ return true;
+ }
+
+ $userGroups = $this->groupManager->getUserGroupIds($user);
+ return empty(array_intersect($allowedGroups, $userGroups));
+ }
+
public function isBreakoutRoomsEnabled(): bool {
return $this->config->getAppValue('spreed', 'breakout_rooms', 'yes') === 'yes';
}