oauth dance works
[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                 );
33             }
34         );
35         $container->registerService(
36             'AccessController',
37             function($c) {
38                 Dependencies::get()->urlGen
39                     = $c->query('ServerContainer')->getURLGenerator();
40                  return new \OCA\Grauphel\Controller\AccessController(
41                     $c->query('AppName'),
42                     $c->query('Request')
43                 );
44             }
45         );
46         $container->registerService(
47             'OauthController',
48             function($c) {
49                 Dependencies::get()->urlGen
50                     = $c->query('ServerContainer')->getURLGenerator();
51                 return new \OCA\Grauphel\Controller\OauthController(
52                     $c->query('AppName'),
53                     $c->query('Request'),
54                     $c->query('Session')->getUser()
55                 );
56             }
57         );
58     }
59 }
60 ?>