2017-05-17 14:41:20 +03:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @copyright Copyright (c) 2017 Arthur Schiwon <blizzz@arthur-schiwon.de>
|
|
|
|
*
|
|
|
|
* @author Arthur Schiwon <blizzz@arthur-schiwon.de>
|
2019-12-03 21:57:53 +03:00
|
|
|
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
|
|
|
|
* @author Greta Doci <gretadoci@gmail.com>
|
|
|
|
* @author Julius Härtl <jus@bitgrid.net>
|
|
|
|
* @author Roeland Jago Douma <roeland@famdouma.nl>
|
2017-05-17 14:41:20 +03:00
|
|
|
*
|
|
|
|
* @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
|
2019-12-03 21:57:53 +03:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2017-05-17 14:41:20 +03:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-09-17 17:33:27 +03:00
|
|
|
namespace OCA\Settings\Personal;
|
2017-05-17 14:41:20 +03:00
|
|
|
|
|
|
|
use OCP\AppFramework\Http\TemplateResponse;
|
2018-06-29 14:01:22 +03:00
|
|
|
use OCP\IUserManager;
|
2017-05-17 14:41:20 +03:00
|
|
|
use OCP\Settings\ISettings;
|
|
|
|
|
2017-06-16 16:34:16 +03:00
|
|
|
class Security implements ISettings {
|
2017-05-17 14:41:20 +03:00
|
|
|
|
2018-09-26 17:25:18 +03:00
|
|
|
/** @var IUserManager */
|
2018-06-29 14:01:22 +03:00
|
|
|
private $userManager;
|
|
|
|
|
2019-09-09 23:12:29 +03:00
|
|
|
/** @var string|null */
|
2019-03-01 16:09:54 +03:00
|
|
|
private $uid;
|
2019-09-09 23:12:29 +03:00
|
|
|
|
2020-01-28 22:48:18 +03:00
|
|
|
public function __construct(IUserManager $userManager,
|
2019-03-01 16:09:54 +03:00
|
|
|
?string $UserId) {
|
2018-06-29 14:01:22 +03:00
|
|
|
$this->userManager = $userManager;
|
2019-03-01 16:09:54 +03:00
|
|
|
$this->uid = $UserId;
|
2018-06-29 14:01:22 +03:00
|
|
|
}
|
|
|
|
|
2019-09-09 23:12:29 +03:00
|
|
|
public function getForm(): TemplateResponse {
|
2019-03-01 16:09:54 +03:00
|
|
|
$user = $this->userManager->get($this->uid);
|
2018-06-29 14:01:22 +03:00
|
|
|
$passwordChangeSupported = false;
|
|
|
|
if ($user !== null) {
|
|
|
|
$passwordChangeSupported = $user->canChangePassword();
|
|
|
|
}
|
|
|
|
|
|
|
|
return new TemplateResponse('settings', 'settings/personal/security', [
|
2018-09-26 17:25:18 +03:00
|
|
|
'passwordChangeSupported' => $passwordChangeSupported,
|
2018-06-29 14:01:22 +03:00
|
|
|
]);
|
2017-05-17 14:41:20 +03:00
|
|
|
}
|
|
|
|
|
2019-09-09 23:12:29 +03:00
|
|
|
public function getSection(): string {
|
2017-06-16 16:34:16 +03:00
|
|
|
return 'security';
|
2017-05-17 14:41:20 +03:00
|
|
|
}
|
|
|
|
|
2019-09-09 23:12:29 +03:00
|
|
|
public function getPriority(): int {
|
2017-05-17 14:41:20 +03:00
|
|
|
return 10;
|
|
|
|
}
|
|
|
|
}
|