aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/admin/oauth2.php
blob: 3fcd62d29ad2dd9fba9607d1e4756581cb734452 (plain)
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
<?php

use Studip\OAuth2\Container;
use Studip\OAuth2\Models\Client;
use Studip\OAuth2\SetupInformation;

class Admin_Oauth2Controller extends AuthenticatedController
{
    /**
     * @param string $action
     * @param string[] $args
     *
     * @return void
     */
    public function before_filter(&$action, &$args)
    {
        parent::before_filter($action, $args);

        $GLOBALS['perm']->check('root');

        Navigation::activateItem('/admin/config/oauth2');
        PageLayout::setTitle(_('OAuth2 Verwaltung'));

        $this->types = [
            'website' => _('Website'),
            'desktop' => _('Herkömmliches Desktopprogramm'),
            'mobile' => _('Mobile App'),
        ];

        // Sidebar
        $views = new ViewsWidget();
        $views->addLink(
            _('Übersicht'),
            $this->indexURL()
        )->setActive($action === 'index');
        Sidebar::get()->addWidget($views);

        $this->container = new Container();
    }

    public function index_action(): void
    {
        $this->setup = $this->container->get(SetupInformation::class);
        $this->clients = Client::findBySql('1 ORDER BY chdate DESC');

        $this->message = $this->flash['oauth2-message'] ?? '';
    }
}