nextcloud/apps/encryption/settings/settings-personal.php

59 lines
1.6 KiB
PHP
Raw Normal View History

2015-02-24 21:05:19 +03:00
<?php
/**
2015-03-27 03:35:36 +03:00
* Copyright (c) 2015 Clark Tomlinson <clark@owncloud.com>
2015-02-24 21:05:19 +03:00
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
$session = new \OCA\Encryption\Session(\OC::$server->getSession());
2015-04-02 14:12:05 +03:00
$userSession = \OC::$server->getUserSession();
2015-04-02 14:12:05 +03:00
$template = new OCP\Template('encryption', 'settings-personal');
$crypt = new \OCA\Encryption\Crypto\Crypt(
\OC::$server->getLogger(),
2015-04-02 14:12:05 +03:00
$userSession,
\OC::$server->getConfig());
2015-03-31 18:13:36 +03:00
$util = new \OCA\Encryption\Util(
new \OC\Files\View(),
$crypt,
\OC::$server->getLogger(),
2015-04-02 14:12:05 +03:00
$userSession,
2015-03-31 18:13:36 +03:00
\OC::$server->getConfig());
2015-04-02 14:12:05 +03:00
$keyManager = new \OCA\Encryption\KeyManager(
\OC::$server->getEncryptionKeyStorage(\OCA\Encryption\Crypto\Encryption::ID),
$crypt,
\OC::$server->getConfig(),
2015-04-02 14:12:05 +03:00
$userSession,
$session,
2015-03-31 18:13:36 +03:00
\OC::$server->getLogger(), $util);
2015-02-24 21:05:19 +03:00
2015-04-02 14:12:05 +03:00
$user = $userSession->getUser()->getUID();
2015-02-24 21:05:19 +03:00
$view = new \OC\Files\View('/');
2015-03-31 18:13:36 +03:00
$privateKeySet = $session->isPrivateKeySet();
2015-02-24 21:05:19 +03:00
// did we tried to initialize the keys for this session?
$initialized = $session->getStatus();
2015-02-24 21:05:19 +03:00
2015-03-27 03:35:36 +03:00
$recoveryAdminEnabled = \OC::$server->getConfig()->getAppValue('encryption', 'recoveryAdminEnabled');
2015-03-31 18:13:36 +03:00
$recoveryEnabledForUser = $util->isRecoveryEnabledForUser();
2015-02-24 21:05:19 +03:00
$result = false;
if ($recoveryAdminEnabled || !$privateKeySet) {
2015-04-02 14:12:05 +03:00
$template->assign('recoveryEnabled', $recoveryAdminEnabled);
$template->assign('recoveryEnabledForUser', $recoveryEnabledForUser);
$template->assign('privateKeySet', $privateKeySet);
$template->assign('initialized', $initialized);
2015-02-24 21:05:19 +03:00
2015-04-02 14:12:05 +03:00
$result = $template->fetchPage();
2015-02-24 21:05:19 +03:00
}
return $result;