Skip to content

Commit efa730d

Browse files
committed
Allow to hide People nav entry for admin
Signed-off-by: Louis Chemineau <[email protected]>
1 parent 9e69169 commit efa730d

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

lib/Controller/PageController.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
use OCP\App\IAppManager;
3737
use OCP\AppFramework\Controller;
3838
use OCP\AppFramework\Http\ContentSecurityPolicy;
39-
use OCP\IL10N;
4039
use OCP\AppFramework\Http\TemplateResponse;
40+
use OCP\AppFramework\Services\IInitialState;
4141
use OCP\EventDispatcher\IEventDispatcher;
4242
use OCP\Files\InvalidPathException;
4343
use OCP\Files\IRootFolder;
@@ -48,7 +48,8 @@
4848
use OCP\Files\Search\ISearchComparison;
4949
use OCP\ICache;
5050
use OCP\ICacheFactory;
51-
use OCP\AppFramework\Services\IInitialState;
51+
use OCP\IConfig;
52+
use OCP\IL10N;
5253
use OCP\IRequest;
5354
use OCP\IUserSession;
5455
use OCP\Util;
@@ -76,6 +77,7 @@ public function __construct(
7677
IRootFolder $rootFolder,
7778
ICacheFactory $cacheFactory,
7879
LoggerInterface $logger,
80+
private IConfig $config,
7981
IL10N $l10n
8082
) {
8183
parent::__construct(Application::APP_ID, $request);
@@ -110,6 +112,7 @@ public function index(): TemplateResponse {
110112
$this->initialState->provideInitialState('maps', $this->appManager->isEnabledForUser('maps') === true);
111113
$this->initialState->provideInitialState('recognize', $this->appManager->isEnabledForUser('recognize') === true);
112114
$this->initialState->provideInitialState('systemtags', $this->appManager->isEnabledForUser('systemtags') === true);
115+
$this->initialState->provideInitialState('showPeopleMenuEntry', $this->config->getAppValue('photos', 'showPeopleMenuEntry', 'true') === 'true');
113116

114117
// Provide user config
115118
foreach (array_keys(UserConfigService::DEFAULT_CONFIGS) as $key) {

src/Photos.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ export default {
187187
: getCurrentUser().isAdmin || isMapsInstalled,
188188
showPeopleMenuEntry: getCurrentUser() === null
189189
? false
190-
: getCurrentUser().isAdmin || isRecognizeInstalled,
190+
: (getCurrentUser().isAdmin && loadState('photos', 'showPeopleMenuEntry', true)) || isRecognizeInstalled,
191191
192192
openedSettings: false,
193193
}

0 commit comments

Comments
 (0)