diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2019-09-26 20:12:24 +0200 |
---|---|---|
committer | npmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com> | 2019-09-28 13:30:34 +0000 |
commit | 9e2bb5ef36b686ec619a069c65712f2d57c3a1cc (patch) | |
tree | b912fa5df8344f0bdad80530502a1a42b9b7704b /apps/oauth2/lib/Settings | |
parent | 17cdcfe4a819708ac7f344d7aca2220a63c40310 (diff) | |
download | nextcloud-server-9e2bb5ef36b686ec619a069c65712f2d57c3a1cc.tar.gz nextcloud-server-9e2bb5ef36b686ec619a069c65712f2d57c3a1cc.zip |
Move oauth admin settings to initialstate
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: npmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>
Diffstat (limited to 'apps/oauth2/lib/Settings')
-rw-r--r-- | apps/oauth2/lib/Settings/Admin.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/apps/oauth2/lib/Settings/Admin.php b/apps/oauth2/lib/Settings/Admin.php index 948306f8857..9c7ffb9e18d 100644 --- a/apps/oauth2/lib/Settings/Admin.php +++ b/apps/oauth2/lib/Settings/Admin.php @@ -22,12 +22,40 @@ declare(strict_types=1); namespace OCA\OAuth2\Settings; +use OCA\OAuth2\Db\ClientMapper; use OCP\AppFramework\Http\TemplateResponse; +use OCP\IInitialStateService; use OCP\Settings\ISettings; class Admin implements ISettings { + /** @var IInitialStateService */ + private $initialStateService; + + /** @var ClientMapper */ + private $clientMapper; + + public function __construct(IInitialStateService $initialStateService, + ClientMapper $clientMapper) { + $this->initialStateService = $initialStateService; + $this->clientMapper = $clientMapper; + } + public function getForm(): TemplateResponse { + $clients = $this->clientMapper->getClients(); + $result = []; + + foreach ($clients as $client) { + $result[] = [ + 'id' => $client->getId(), + 'name' => $client->getName(), + 'redirectUri' => $client->getRedirectUri(), + 'clientId' => $client->getClientIdentifier(), + 'clientSecret' => $client->getSecret(), + ]; + } + $this->initialStateService->provideInitialState('oauth2', 'clients', $result); + return new TemplateResponse( 'oauth2', 'admin', |