diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2015-03-28 11:02:26 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-04-07 13:30:28 +0200 |
commit | c64e0af4fb44b1464ca3433e99b12b729a2084b2 (patch) | |
tree | d2528e9e4e375cddc665adeb4aa84fa27e62c989 /lib/private/encryption | |
parent | 24c6604388c0c3a32517e1aa18ebd851e1f7a6a1 (diff) | |
download | nextcloud-server-c64e0af4fb44b1464ca3433e99b12b729a2084b2.tar.gz nextcloud-server-c64e0af4fb44b1464ca3433e99b12b729a2084b2.zip |
check if recovery key exists and encrypt the file with the recovery key if needed
Diffstat (limited to 'lib/private/encryption')
-rw-r--r-- | lib/private/encryption/util.php | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/lib/private/encryption/util.php b/lib/private/encryption/util.php index 85e852ec2c9..e3390f155d4 100644 --- a/lib/private/encryption/util.php +++ b/lib/private/encryption/util.php @@ -26,6 +26,7 @@ namespace OC\Encryption; use OC\Encryption\Exceptions\EncryptionHeaderToLargeException; use OC\Encryption\Exceptions\EncryptionHeaderKeyExistsException; use OCP\Encryption\IEncryptionModule; +use OCP\IConfig; class Util { @@ -58,19 +59,27 @@ class Util { /** @var \OC\User\Manager */ protected $userManager; + /** @var IConfig */ + protected $config; + /** @var array paths excluded from encryption */ protected $excludedPaths; /** * @param \OC\Files\View $view root view */ - public function __construct(\OC\Files\View $view, \OC\User\Manager $userManager) { + public function __construct( + \OC\Files\View $view, + \OC\User\Manager $userManager, + IConfig $config) { + $this->ocHeaderKeys = [ self::HEADER_ENCRYPTION_MODULE_KEY ]; $this->view = $view; $this->userManager = $userManager; + $this->config = $config; $this->excludedPaths[] = 'files_encryption'; } @@ -411,4 +420,16 @@ class Util { return false; } + /** + * check if recovery key is enabled for user + * + * @param string $uid + * @return boolean + */ + public function recoveryEnabled($uid) { + $enabled = $this->config->getUserValue($uid, 'encryption', 'recovery_enabled', '0'); + + return ($enabled === '1') ? true : false; + } + } |