Deleting tokens works (without confirmation)
[grauphel.git] / appinfo / application.php
1 <?php
2 namespace OCA\Grauphel\AppInfo;
3 use \OCP\AppFramework\App;
4 use \OCA\Grauphel\Lib\Dependencies;
5
6 class Application extends App
7 {
8     public function __construct(array $urlParams=array())
9     {
10         parent::__construct('grauphel', $urlParams);
11
12         $container = $this->getContainer();
13
14         $container->registerService(
15             'Session',
16             function($c) {
17                 return $c->query('ServerContainer')->getUserSession();
18             }
19         );
20
21         /**
22          * Controllers
23          */
24         $container->registerService(
25             'ApiController',
26             function($c) {
27                 Dependencies::get()->urlGen
28                     = $c->query('ServerContainer')->getURLGenerator();
29                 return new \OCA\Grauphel\Controller\ApiController(
30                     $c->query('AppName'),
31                     $c->query('Request'),
32                     $c->query('Session')->getUser()
33                 );
34             }
35         );
36         $container->registerService(
37             'OauthController',
38             function($c) {
39                 Dependencies::get()->urlGen
40                     = $c->query('ServerContainer')->getURLGenerator();
41                 return new \OCA\Grauphel\Controller\OauthController(
42                     $c->query('AppName'),
43                     $c->query('Request'),
44                     $c->query('Session')->getUser()
45                 );
46             }
47         );
48         $container->registerService(
49             'GuiController',
50             function($c) {
51                 return new \OCA\Grauphel\Controller\GuiController(
52                     $c->query('AppName'),
53                     $c->query('Request'),
54                     $c->query('Session')->getUser(),
55                     $c->query('ServerContainer')->getURLGenerator()
56                 );
57             }
58         );
59         $container->registerService(
60             'TokenController',
61             function($c) {
62                 Dependencies::get()->urlGen
63                     = $c->query('ServerContainer')->getURLGenerator();
64                 return new \OCA\Grauphel\Controller\TokenController(
65                     $c->query('AppName'),
66                     $c->query('Request'),
67                     $c->query('Session')->getUser()
68                 );
69             }
70         );
71     }
72 }
73 ?>