Skip to content

Commit

Permalink
Allow to hide People nav entry for admin
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Chemineau <louis@chmn.me>
  • Loading branch information
artonge committed Jan 3, 2024
1 parent 38610e7 commit ee3a46c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
use OCP\Files\Search\ISearchComparison;
use OCP\ICache;
use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\IL10N;
use OCP\IRequest;
use OCP\IUserSession;
Expand Down Expand Up @@ -76,6 +77,7 @@ public function __construct(
IRootFolder $rootFolder,
ICacheFactory $cacheFactory,
LoggerInterface $logger,
private IConfig $config,
IL10N $l10n
) {
parent::__construct(Application::APP_ID, $request);
Expand Down Expand Up @@ -110,6 +112,7 @@ public function index(): TemplateResponse {
$this->initialState->provideInitialState('maps', $this->appManager->isEnabledForUser('maps') === true);
$this->initialState->provideInitialState('recognize', $this->appManager->isEnabledForUser('recognize') === true);
$this->initialState->provideInitialState('systemtags', $this->appManager->isEnabledForUser('systemtags') === true);
$this->initialState->provideInitialState('showPeopleMenuEntry', $this->config->getAppValue('photos', 'showPeopleMenuEntry', 'true') === 'true');

// Provide user config
foreach (array_keys(UserConfigService::DEFAULT_CONFIGS) as $key) {
Expand Down
2 changes: 1 addition & 1 deletion src/Photos.vue
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export default {
: getCurrentUser().isAdmin || isMapsInstalled,
showPeopleMenuEntry: getCurrentUser() === null
? false
: getCurrentUser().isAdmin || isRecognizeInstalled,
: (getCurrentUser().isAdmin && loadState('photos', 'showPeopleMenuEntry', true)) || isRecognizeInstalled,
openedSettings: false,
}
Expand Down

0 comments on commit ee3a46c

Please sign in to comment.