-
Notifications
You must be signed in to change notification settings - Fork 19
/
Admin.php
53 lines (43 loc) · 1.26 KB
/
Admin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
namespace OCA\OpenProject\Settings;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
use OCP\IConfig;
use OCP\Settings\ISettings;
use OCA\OpenProject\AppInfo\Application;
class Admin implements ISettings {
/**
* @var IConfig
*/
private $config;
/**
* @var IInitialState
*/
private $initialStateService;
public function __construct(IConfig $config,
IInitialState $initialStateService) {
$this->config = $config;
$this->initialStateService = $initialStateService;
}
/**
* @return TemplateResponse
*/
public function getForm(): TemplateResponse {
$clientID = $this->config->getAppValue(Application::APP_ID, 'client_id');
$clientSecret = $this->config->getAppValue(Application::APP_ID, 'client_secret');
$oauthUrl = $this->config->getAppValue(Application::APP_ID, 'oauth_instance_url');
$adminConfig = [
'client_id' => $clientID,
'client_secret' => $clientSecret,
'oauth_instance_url' => $oauthUrl,
];
$this->initialStateService->provideInitialState('admin-config', $adminConfig);
return new TemplateResponse(Application::APP_ID, 'adminSettings');
}
public function getSection(): string {
return 'connected-accounts';
}
public function getPriority(): int {
return 10;
}
}