From 39ca06e6b9bfc85efc6c2f15090b0719b1e4f0ef Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Fri, 23 Jun 2017 13:38:33 +0200 Subject: fix setting up encryption section Signed-off-by: Arthur Schiwon --- apps/encryption/lib/Settings/PersonalSection.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'apps/encryption/lib') diff --git a/apps/encryption/lib/Settings/PersonalSection.php b/apps/encryption/lib/Settings/PersonalSection.php index 70e826a6ea1..fd25d25ef8f 100644 --- a/apps/encryption/lib/Settings/PersonalSection.php +++ b/apps/encryption/lib/Settings/PersonalSection.php @@ -29,6 +29,7 @@ use OCA\Encryption\Session; use OCP\IConfig; use OCP\IL10N; use OCP\IURLGenerator; +use OCP\IUserSession; use OCP\Settings\IIconSection; class PersonalSection implements IIconSection { @@ -43,13 +44,23 @@ class PersonalSection implements IIconSection { private $config; /** @var Session */ private $session; + /** @var IUserSession */ + private $userSession; - public function __construct(IURLGenerator $urlGenerator, IL10N $l, Application $app, IConfig $config, Session $session) { + public function __construct( + IURLGenerator $urlGenerator, + IL10N $l, + Application $app, + IConfig $config, + Session $session, + IUserSession $userSession + ) { $this->urlGenerator = $urlGenerator; $this->l = $l; $this->app = $app; $this->config = $config; $this->session = $session; + $this->userSession = $userSession; } /** @@ -71,10 +82,13 @@ class PersonalSection implements IIconSection { * @since 9.1 */ public function getID() { + // we need to return the proper id while installing/upgrading the app + $loggedIn = $this->userSession->isLoggedIn(); + $recoveryAdminEnabled = $this->config->getAppValue('encryption', 'recoveryAdminEnabled'); $privateKeySet = $this->session->isPrivateKeySet(); - if (!$recoveryAdminEnabled && $privateKeySet) { + if ($loggedIn && !$recoveryAdminEnabled && $privateKeySet) { return null; } return 'encryption'; -- cgit v1.2.3