Browse Source

feat(initial-state): Add own user groups to initial state

Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/9436/head
Joas Schilling 2 years ago
parent
commit
6d4189348a
No known key found for this signature in database GPG Key ID: C400AAF20C1BB6FC
  1. 3
      lib/Controller/PageController.php
  2. 3
      lib/Files/TemplateLoader.php
  3. 3
      lib/PublicShare/TemplateLoader.php
  4. 3
      lib/PublicShareAuth/TemplateLoader.php
  5. 8
      lib/TInitialState.php

3
lib/Controller/PageController.php

@ -58,6 +58,7 @@ use OCP\Files\IRootFolder;
use OCP\HintException; use OCP\HintException;
use OCP\ICacheFactory; use OCP\ICacheFactory;
use OCP\IConfig; use OCP\IConfig;
use OCP\IGroupManager;
use OCP\IRequest; use OCP\IRequest;
use OCP\IURLGenerator; use OCP\IURLGenerator;
use OCP\IUser; use OCP\IUser;
@ -105,6 +106,7 @@ class PageController extends Controller {
IThrottler $throttler, IThrottler $throttler,
Config $talkConfig, Config $talkConfig,
IConfig $serverConfig, IConfig $serverConfig,
IGroupManager $groupManager,
) { ) {
parent::__construct($appName, $request); parent::__construct($appName, $request);
$this->eventDispatcher = $eventDispatcher; $this->eventDispatcher = $eventDispatcher;
@ -125,6 +127,7 @@ class PageController extends Controller {
$this->throttler = $throttler; $this->throttler = $throttler;
$this->talkConfig = $talkConfig; $this->talkConfig = $talkConfig;
$this->serverConfig = $serverConfig; $this->serverConfig = $serverConfig;
$this->groupManager = $groupManager;
} }
/** /**

3
lib/Files/TemplateLoader.php

@ -36,6 +36,7 @@ use OCP\EventDispatcher\IEventListener;
use OCP\Files\IRootFolder; use OCP\Files\IRootFolder;
use OCP\ICacheFactory; use OCP\ICacheFactory;
use OCP\IConfig; use OCP\IConfig;
use OCP\IGroupManager;
use OCP\IUser; use OCP\IUser;
use OCP\IUserSession; use OCP\IUserSession;
use OCP\Util; use OCP\Util;
@ -60,6 +61,7 @@ class TemplateLoader implements IEventListener {
IAppManager $appManager, IAppManager $appManager,
IRootFolder $rootFolder, IRootFolder $rootFolder,
IUserSession $userSession, IUserSession $userSession,
IGroupManager $groupManager,
) { ) {
$this->initialState = $initialState; $this->initialState = $initialState;
$this->memcacheFactory = $memcacheFactory; $this->memcacheFactory = $memcacheFactory;
@ -68,6 +70,7 @@ class TemplateLoader implements IEventListener {
$this->appManager = $appManager; $this->appManager = $appManager;
$this->rootFolder = $rootFolder; $this->rootFolder = $rootFolder;
$this->userSession = $userSession; $this->userSession = $userSession;
$this->groupManager = $groupManager;
} }

3
lib/PublicShare/TemplateLoader.php

@ -35,6 +35,7 @@ use OCP\EventDispatcher\IEventListener;
use OCP\Files\FileInfo; use OCP\Files\FileInfo;
use OCP\ICacheFactory; use OCP\ICacheFactory;
use OCP\IConfig; use OCP\IConfig;
use OCP\IGroupManager;
use OCP\Util; use OCP\Util;
/** /**
@ -52,11 +53,13 @@ class TemplateLoader implements IEventListener {
ICacheFactory $memcacheFactory, ICacheFactory $memcacheFactory,
Config $talkConfig, Config $talkConfig,
IConfig $serverConfig, IConfig $serverConfig,
IGroupManager $groupManager,
) { ) {
$this->initialState = $initialState; $this->initialState = $initialState;
$this->talkConfig = $talkConfig; $this->talkConfig = $talkConfig;
$this->memcacheFactory = $memcacheFactory; $this->memcacheFactory = $memcacheFactory;
$this->serverConfig = $serverConfig; $this->serverConfig = $serverConfig;
$this->groupManager = $groupManager;
} }
/** /**

3
lib/PublicShareAuth/TemplateLoader.php

@ -34,6 +34,7 @@ use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener; use OCP\EventDispatcher\IEventListener;
use OCP\ICacheFactory; use OCP\ICacheFactory;
use OCP\IConfig; use OCP\IConfig;
use OCP\IGroupManager;
use OCP\Util; use OCP\Util;
/** /**
@ -51,11 +52,13 @@ class TemplateLoader implements IEventListener {
ICacheFactory $memcacheFactory, ICacheFactory $memcacheFactory,
Config $talkConfig, Config $talkConfig,
IConfig $serverConfig, IConfig $serverConfig,
IGroupManager $groupManager,
) { ) {
$this->initialState = $initialState; $this->initialState = $initialState;
$this->talkConfig = $talkConfig; $this->talkConfig = $talkConfig;
$this->memcacheFactory = $memcacheFactory; $this->memcacheFactory = $memcacheFactory;
$this->serverConfig = $serverConfig; $this->serverConfig = $serverConfig;
$this->groupManager = $groupManager;
} }
/** /**

8
lib/TInitialState.php

@ -32,6 +32,7 @@ use OCP\Files\NotPermittedException;
use OCP\HintException; use OCP\HintException;
use OCP\ICacheFactory; use OCP\ICacheFactory;
use OCP\IConfig; use OCP\IConfig;
use OCP\IGroupManager;
use OCP\IUser; use OCP\IUser;
use OCP\Util; use OCP\Util;
@ -44,6 +45,7 @@ trait TInitialState {
protected $initialState; protected $initialState;
/** @var ICacheFactory */ /** @var ICacheFactory */
protected $memcacheFactory; protected $memcacheFactory;
protected IGroupManager $groupManager;
protected function publishInitialStateShared(): void { protected function publishInitialStateShared(): void {
// Needed to enable the screensharing extension in Chromium < 72 // 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->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()); $attachmentFolder = $this->talkConfig->getAttachmentFolder($user->getUID());
$freeSpace = 0; $freeSpace = 0;

Loading…
Cancel
Save