|
1
|
|
|
<?php
|
|
2
|
|
|
/**
|
|
3
|
|
|
* @author Semih Serhat Karakaya <[email protected]>
|
|
4
|
|
|
* @copyright Copyright (c) 2017, ownCloud GmbH.
|
|
5
|
|
|
* @license AGPL-3.0
|
|
6
|
|
|
*
|
|
7
|
|
|
* This code is free software: you can redistribute it and/or modify
|
|
8
|
|
|
* it under the terms of the GNU Affero General Public License, version 3,
|
|
9
|
|
|
* as published by the Free Software Foundation.
|
|
10
|
|
|
*
|
|
11
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
12
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
|
|
* GNU Affero General Public License for more details.
|
|
15
|
|
|
*
|
|
16
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3,
|
|
17
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
18
|
|
|
*/
|
|
19
|
|
|
|
|
20
|
|
|
namespace OCA\Security\Panels;
|
|
21
|
|
|
|
|
22
|
|
|
use OCA\Security\SecurityConfig;
|
|
23
|
|
|
use OCP\AppFramework\Http\TemplateResponse;
|
|
24
|
|
|
use OCP\Settings\ISettings;
|
|
25
|
|
|
use OCP\Template;
|
|
26
|
|
|
|
|
27
|
|
View Code Duplication |
class AdminPanel implements ISettings {
|
|
|
|
|
|
|
28
|
|
|
|
|
29
|
|
|
/** @var SecurityConfig */
|
|
30
|
|
|
private $config;
|
|
31
|
|
|
|
|
32
|
|
|
public function __construct(SecurityConfig $config) {
|
|
33
|
|
|
$this->config = $config;
|
|
34
|
|
|
}
|
|
35
|
|
|
|
|
36
|
|
|
public function getPanel() {
|
|
37
|
|
|
$params = $this->config->getAllSecurityConfigs();
|
|
38
|
|
|
$tmpl = new Template('security', 'settings-admin');
|
|
39
|
|
|
foreach ($params as $key => $value) {
|
|
40
|
|
|
$tmpl->assign($key, $value);
|
|
41
|
|
|
}
|
|
42
|
|
|
return $tmpl;
|
|
43
|
|
|
}
|
|
44
|
|
|
|
|
45
|
|
|
public function getSectionID() {
|
|
46
|
|
|
return 'security';
|
|
47
|
|
|
}
|
|
48
|
|
|
|
|
49
|
|
|
public function getPriority() {
|
|
50
|
|
|
return 100;
|
|
51
|
|
|
}
|
|
52
|
|
|
} |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.