|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @author Tom Needham <[email protected]> |
|
4
|
|
|
* |
|
5
|
|
|
* @copyright Copyright (c) 2016, ownCloud GmbH. |
|
6
|
|
|
* @license AGPL-3.0 |
|
7
|
|
|
* |
|
8
|
|
|
* This code is free software: you can redistribute it and/or modify |
|
9
|
|
|
* it under the terms of the GNU Affero General Public License, version 3, |
|
10
|
|
|
* as published by the Free Software Foundation. |
|
11
|
|
|
* |
|
12
|
|
|
* This program is distributed in the hope that it will be useful, |
|
13
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15
|
|
|
* GNU Affero General Public License for more details. |
|
16
|
|
|
* |
|
17
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3, |
|
18
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/> |
|
19
|
|
|
* |
|
20
|
|
|
*/ |
|
21
|
|
|
|
|
22
|
|
|
namespace OC\Settings\Panels\Admin; |
|
23
|
|
|
|
|
24
|
|
|
use OCP\ICertificateManager; |
|
25
|
|
|
use OCP\Settings\ISettings; |
|
26
|
|
|
use OCP\Template; |
|
27
|
|
|
use OCP\IConfig; |
|
28
|
|
|
use OCP\IURLGenerator; |
|
29
|
|
|
|
|
30
|
|
|
class Certificates implements ISettings { |
|
31
|
|
|
|
|
32
|
|
|
/** @var IConfig */ |
|
33
|
|
|
protected $config; |
|
34
|
|
|
/** @var ICertificateManager */ |
|
35
|
|
|
protected $certificateManager; |
|
36
|
|
|
/** @var IURLGenerator */ |
|
37
|
|
|
protected $urlGenerator; |
|
38
|
|
|
|
|
39
|
|
|
public function __construct(IConfig $config, |
|
40
|
|
|
IURLGenerator $urlGenerator, |
|
41
|
|
|
ICertificateManager $certificateManager) { |
|
42
|
|
|
$this->config = $config; |
|
43
|
|
|
$this->urlGenerator = $urlGenerator; |
|
44
|
|
|
$this->certificateManager = $certificateManager; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
public function getPriority() { |
|
48
|
|
|
return 0; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
View Code Duplication |
public function getPanel() { |
|
52
|
|
|
if ($this->config->getSystemValue('enable_certificate_management', false)) { |
|
53
|
|
|
$tmpl = new Template('settings', 'panels/admin/certificates'); |
|
54
|
|
|
$tmpl->assign('type', 'admin'); |
|
55
|
|
|
$tmpl->assign('uploadRoute', 'settings.Certificate.addSystemRootCertificate'); |
|
56
|
|
|
$tmpl->assign('certs', $this->certificateManager->listCertificates()); |
|
57
|
|
|
$tmpl->assign('urlGenerator', $this->urlGenerator); |
|
|
|
|
|
|
58
|
|
|
return $tmpl; |
|
|
|
|
|
|
59
|
|
|
} else { |
|
60
|
|
|
return null; |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
public function getSectionID() { |
|
65
|
|
|
return 'general'; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
} |
|
69
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: