aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/api/authorizations.php
blob: 543bc7951cb7a4fb6b8c6ac12eb435b8ad0888a4 (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
49
50
51
52
53
54
55
56
57
58
<?php

require_once 'lib/bootstrap-api.php';

/**
* @deprecated Since Stud.IP 5.0. Will be removed in Stud.IP 6.0.
 **/
class Api_AuthorizationsController extends AuthenticatedController
{
    /**
     *
     **/
    public function before_filter(&$action, &$args)
    {
        parent::before_filter($action, $args);

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

        Navigation::activateItem('/profile/settings/api');
        PageLayout::setTitle(_('Applikationen'));

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

    /**
     *
     **/
    public function index_action()
    {
        $this->consumers = RESTAPI\UserPermissions::get($GLOBALS['user']->id)->getConsumers();
        $this->types = [
            'website' => _('Website'),
            'program' => _('Herkömmliches Desktopprogramm'),
            'app'     => _('Mobile App')
        ];

        $widget = new SidebarWidget();
        $widget->setTitle(_('Informationen'));
        $widget->addElement(new WidgetElement(_('Dies sind die Apps, die Zugriff auf Ihren Account haben.')));
        Sidebar::Get()->addWidget($widget);
    }

    /**
     *
     **/
    public function revoke_action($id)
    {
        $consumer = new RESTAPI\Consumer\OAuth($id);
        $consumer->revokeAccess($GLOBALS['user']->id);

        PageLayout::postMessage(MessageBox::success(_('Der Applikation wurde der Zugriff auf Ihre Daten untersagt.')));
        $this->redirect('api/authorizations');
    }
}