diff options
author | Joas Schilling <coding@schilljs.com> | 2023-05-03 20:02:58 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-05-03 20:02:58 +0200 |
commit | 6d4189348a512c189ae3c14a6e3f6b5858303d0b (patch) | |
tree | 58aad7f82e8c5963a03f5bf02a9f56cdd3e9dcca /lib | |
parent | 22486658dfb52ab04c3ae40113df412540f2723e (diff) |
feat(initial-state): Add own user groups to initial state
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Controller/PageController.php | 3 | ||||
-rw-r--r-- | lib/Files/TemplateLoader.php | 3 | ||||
-rw-r--r-- | lib/PublicShare/TemplateLoader.php | 3 | ||||
-rw-r--r-- | lib/PublicShareAuth/TemplateLoader.php | 3 | ||||
-rw-r--r-- | lib/TInitialState.php | 8 |
5 files changed, 20 insertions, 0 deletions
diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index fc92e83c4..0909e3fec 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -58,6 +58,7 @@ use OCP\Files\IRootFolder; use OCP\HintException; use OCP\ICacheFactory; use OCP\IConfig; +use OCP\IGroupManager; use OCP\IRequest; use OCP\IURLGenerator; use OCP\IUser; @@ -105,6 +106,7 @@ class PageController extends Controller { IThrottler $throttler, Config $talkConfig, IConfig $serverConfig, + IGroupManager $groupManager, ) { parent::__construct($appName, $request); $this->eventDispatcher = $eventDispatcher; @@ -125,6 +127,7 @@ class PageController extends Controller { $this->throttler = $throttler; $this->talkConfig = $talkConfig; $this->serverConfig = $serverConfig; + $this->groupManager = $groupManager; } /** diff --git a/lib/Files/TemplateLoader.php b/lib/Files/TemplateLoader.php index 96307e077..3e1e61b54 100644 --- a/lib/Files/TemplateLoader.php +++ b/lib/Files/TemplateLoader.php @@ -36,6 +36,7 @@ use OCP\EventDispatcher\IEventListener; use OCP\Files\IRootFolder; use OCP\ICacheFactory; use OCP\IConfig; +use OCP\IGroupManager; use OCP\IUser; use OCP\IUserSession; use OCP\Util; @@ -60,6 +61,7 @@ class TemplateLoader implements IEventListener { IAppManager $appManager, IRootFolder $rootFolder, IUserSession $userSession, + IGroupManager $groupManager, ) { $this->initialState = $initialState; $this->memcacheFactory = $memcacheFactory; @@ -68,6 +70,7 @@ class TemplateLoader implements IEventListener { $this->appManager = $appManager; $this->rootFolder = $rootFolder; $this->userSession = $userSession; + $this->groupManager = $groupManager; } diff --git a/lib/PublicShare/TemplateLoader.php b/lib/PublicShare/TemplateLoader.php index ad264acc0..0274c7a32 100644 --- a/lib/PublicShare/TemplateLoader.php +++ b/lib/PublicShare/TemplateLoader.php @@ -35,6 +35,7 @@ use OCP\EventDispatcher\IEventListener; use OCP\Files\FileInfo; use OCP\ICacheFactory; use OCP\IConfig; +use OCP\IGroupManager; use OCP\Util; /** @@ -52,11 +53,13 @@ class TemplateLoader implements IEventListener { ICacheFactory $memcacheFactory, Config $talkConfig, IConfig $serverConfig, + IGroupManager $groupManager, ) { $this->initialState = $initialState; $this->talkConfig = $talkConfig; $this->memcacheFactory = $memcacheFactory; $this->serverConfig = $serverConfig; + $this->groupManager = $groupManager; } /** diff --git a/lib/PublicShareAuth/TemplateLoader.php b/lib/PublicShareAuth/TemplateLoader.php index db08377ce..8dec68cbe 100644 --- a/lib/PublicShareAuth/TemplateLoader.php +++ b/lib/PublicShareAuth/TemplateLoader.php @@ -34,6 +34,7 @@ use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; use OCP\ICacheFactory; use OCP\IConfig; +use OCP\IGroupManager; use OCP\Util; /** @@ -51,11 +52,13 @@ class TemplateLoader implements IEventListener { ICacheFactory $memcacheFactory, Config $talkConfig, IConfig $serverConfig, + IGroupManager $groupManager, ) { $this->initialState = $initialState; $this->talkConfig = $talkConfig; $this->memcacheFactory = $memcacheFactory; $this->serverConfig = $serverConfig; + $this->groupManager = $groupManager; } /** diff --git a/lib/TInitialState.php b/lib/TInitialState.php index a9e5a5b82..b02eeecab 100644 --- a/lib/TInitialState.php +++ b/lib/TInitialState.php @@ -32,6 +32,7 @@ use OCP\Files\NotPermittedException; use OCP\HintException; use OCP\ICacheFactory; use OCP\IConfig; +use OCP\IGroupManager; use OCP\IUser; use OCP\Util; @@ -44,6 +45,7 @@ trait TInitialState { protected $initialState; /** @var ICacheFactory */ protected $memcacheFactory; + protected IGroupManager $groupManager; protected function publishInitialStateShared(): void { // Needed to enable the screensharing extension in Chromium < 72 @@ -124,6 +126,12 @@ trait TInitialState { $this->serverConfig->getUserValue($user->getUID(), 'spreed', 'play_sounds', 'yes') === 'yes' ); + + $this->initialState->provideInitialState( + 'user_group_ids', + $this->groupManager->getUserGroupIds($user) + ); + $attachmentFolder = $this->talkConfig->getAttachmentFolder($user->getUID()); $freeSpace = 0; |