1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @copyright Copyright (c) 2017 Arthur Schiwon <[email protected]> |
4
|
|
|
* |
5
|
|
|
* @author Arthur Schiwon <[email protected]> |
6
|
|
|
* @author Christoph Wurst <[email protected]> |
7
|
|
|
* @author Greta Doci <[email protected]> |
8
|
|
|
* @author Julius Härtl <[email protected]> |
9
|
|
|
* @author Roeland Jago Douma <[email protected]> |
10
|
|
|
* |
11
|
|
|
* @license GNU AGPL version 3 or any later version |
12
|
|
|
* |
13
|
|
|
* This program is free software: you can redistribute it and/or modify |
14
|
|
|
* it under the terms of the GNU Affero General Public License as |
15
|
|
|
* published by the Free Software Foundation, either version 3 of the |
16
|
|
|
* License, or (at your option) any later version. |
17
|
|
|
* |
18
|
|
|
* This program is distributed in the hope that it will be useful, |
19
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
20
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21
|
|
|
* GNU Affero General Public License for more details. |
22
|
|
|
* |
23
|
|
|
* You should have received a copy of the GNU Affero General Public License |
24
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
25
|
|
|
* |
26
|
|
|
*/ |
27
|
|
|
|
28
|
|
|
namespace OCA\Settings\Personal; |
29
|
|
|
|
30
|
|
|
use OCP\AppFramework\Http\TemplateResponse; |
31
|
|
|
use OCP\IUserManager; |
32
|
|
|
use OCP\Settings\ISettings; |
33
|
|
|
|
34
|
|
|
class Security implements ISettings { |
35
|
|
|
|
36
|
|
|
/** @var IUserManager */ |
37
|
|
|
private $userManager; |
38
|
|
|
|
39
|
|
|
/** @var string|null */ |
40
|
|
|
private $uid; |
41
|
|
|
|
42
|
|
|
public function __construct(IUserManager $userManager, |
43
|
|
|
?string $UserId) { |
44
|
|
|
$this->userManager = $userManager; |
45
|
|
|
$this->uid = $UserId; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
public function getForm(): TemplateResponse { |
49
|
|
|
$user = $this->userManager->get($this->uid); |
50
|
|
|
$passwordChangeSupported = false; |
51
|
|
|
if ($user !== null) { |
52
|
|
|
$passwordChangeSupported = $user->canChangePassword(); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
return new TemplateResponse('settings', 'settings/personal/security', [ |
56
|
|
|
'passwordChangeSupported' => $passwordChangeSupported, |
57
|
|
|
]); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function getSection(): string { |
61
|
|
|
return 'security'; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function getPriority(): int { |
65
|
|
|
return 10; |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|