diff options
author | Bjoern Schiessle <bjoern@schiessle.org> | 2017-04-10 18:36:23 +0200 |
---|---|---|
committer | Bjoern Schiessle <bjoern@schiessle.org> | 2017-04-20 16:33:26 +0200 |
commit | d8dcd72118f7f5f83874e3a54a7fbc02bda10ce6 (patch) | |
tree | 7da5dbe03601c1c52398b4a32460e5aad0dadf11 /apps/sharebymail/lib/Settings | |
parent | 140580f9d8468b8450f31dca997916a07693277f (diff) | |
download | nextcloud-server-d8dcd72118f7f5f83874e3a54a7fbc02bda10ce6.tar.gz nextcloud-server-d8dcd72118f7f5f83874e3a54a7fbc02bda10ce6.zip |
allow admin to enforce password on mail shares
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'apps/sharebymail/lib/Settings')
-rw-r--r-- | apps/sharebymail/lib/Settings/Admin.php | 3 | ||||
-rw-r--r-- | apps/sharebymail/lib/Settings/SettingsManager.php | 16 |
2 files changed, 16 insertions, 3 deletions
diff --git a/apps/sharebymail/lib/Settings/Admin.php b/apps/sharebymail/lib/Settings/Admin.php index b6e7e5d3b4a..93a8d3aafa4 100644 --- a/apps/sharebymail/lib/Settings/Admin.php +++ b/apps/sharebymail/lib/Settings/Admin.php @@ -40,7 +40,8 @@ class Admin implements ISettings { public function getForm() { $parameters = [ - 'sendPasswordMail' => $this->settingsManager->sendPasswordByMail() + 'sendPasswordMail' => $this->settingsManager->sendPasswordByMail(), + 'enforcePasswordProtection' => $this->settingsManager->enforcePasswordProtection() ]; return new TemplateResponse('sharebymail', 'settings-admin', $parameters, ''); diff --git a/apps/sharebymail/lib/Settings/SettingsManager.php b/apps/sharebymail/lib/Settings/SettingsManager.php index 205b253f337..2b35e5833a7 100644 --- a/apps/sharebymail/lib/Settings/SettingsManager.php +++ b/apps/sharebymail/lib/Settings/SettingsManager.php @@ -30,7 +30,9 @@ class SettingsManager { /** @var IConfig */ private $config; - private $defaultSetting = 'yes'; + private $sendPasswordByMailDefault = 'yes'; + + private $enforcePasswordProtectionDefault = 'no'; public function __construct(IConfig $config) { $this->config = $config; @@ -42,8 +44,18 @@ class SettingsManager { * @return bool */ public function sendPasswordByMail() { - $sendPasswordByMail = $this->config->getAppValue('sharebymail', 'sendpasswordmail', $this->defaultSetting); + $sendPasswordByMail = $this->config->getAppValue('sharebymail', 'sendpasswordmail', $this->sendPasswordByMailDefault); return $sendPasswordByMail === 'yes'; } + /** + * do we require a share by mail to be password protected + * + * @return bool + */ + public function enforcePasswordProtection() { + $enforcePassword = $this->config->getAppValue('sharebymail', 'enforcePasswordProtection', $this->enforcePasswordProtectionDefault); + return $enforcePassword === 'yes'; + } + } |