diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2017-04-12 17:50:17 +0300 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2017-04-12 17:50:17 +0300 |
commit | 12561603a519d15870f9ce4aec9ed63144753dab (patch) | |
tree | 9cd06edf454aed27866789757c1983db94b06c9e /lib | |
parent | 661dadbb93a860c2cd0dc3faef45bd83eb2fa630 (diff) |
Move settings over to ISettings
* Move to new and improved ISettings
* Bump version
* Moved to security section
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Settings.php | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/lib/Settings.php b/lib/Settings.php new file mode 100644 index 0000000..50ea90a --- /dev/null +++ b/lib/Settings.php @@ -0,0 +1,58 @@ +<?php +/** + * @copyright 2017, Roeland Jago Douma <roeland@famdouma.nl> + * + * @author Roeland Jago Douma <roeland@famdouma.nl> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +namespace OCA\Password_Policy; + +use OCP\AppFramework\Http\TemplateResponse; +use OCP\Settings\ISettings; + +class Settings implements ISettings { + + /** @var PasswordPolicyConfig */ + private $config; + + public function __construct(PasswordPolicyConfig $config) { + $this->config = $config; + } + + public function getForm() { + $response = new TemplateResponse('password_policy', 'settings-admin'); + $response->setParams([ + 'minLength' => $this->config->getMinLength(), + 'enforceNonCommonPassword' => $this->config->getEnforceNonCommonPassword(), + 'enforceUpperLowerCase' => $this->config->getEnforceUpperLowerCase(), + 'enforceNumericCharacters' => $this->config->getEnforceNumericCharacters(), + 'enforceSpecialCharacters' => $this->config->getEnforceSpecialCharacters(), + ]); + + return $response; + } + + public function getSection() { + return 'security'; + } + + public function getPriority() { + return 50; + } +} |