Release 0.7.2
[grauphel.git] / appinfo / application.php
index ecee129..7761eb5 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 namespace OCA\Grauphel\AppInfo;
 use \OCP\AppFramework\App;
+use \OCA\Grauphel\Lib\Dependencies;
 
 class Application extends App
 {
@@ -10,33 +11,70 @@ class Application extends App
 
         $container = $this->getContainer();
 
+        $container->registerService(
+            'Session',
+            function($c) {
+                return $c->query('ServerContainer')->getUserSession();
+            }
+        );
+
         /**
          * Controllers
          */
         $container->registerService(
-           'ApiController',
+            'ApiController',
             function($c) {
+                Dependencies::get()->urlGen
+                    = $c->query('ServerContainer')->getURLGenerator();
                 return new \OCA\Grauphel\Controller\ApiController(
                     $c->query('AppName'),
-                    $c->query('Request')
+                    $c->query('Request'),
+                    $c->query('Session')->getUser()
+                );
+            }
+        );
+        $container->registerService(
+            'OauthController',
+            function($c) {
+                Dependencies::get()->urlGen
+                    = $c->query('ServerContainer')->getURLGenerator();
+                return new \OCA\Grauphel\Controller\OauthController(
+                    $c->query('AppName'),
+                    $c->query('Request'),
+                    $c->query('Session')->getUser()
+                );
+            }
+        );
+        $container->registerService(
+            'GuiController',
+            function($c) {
+                return new \OCA\Grauphel\Controller\GuiController(
+                    $c->query('AppName'),
+                    $c->query('Request'),
+                    $c->query('Session')->getUser(),
+                    $c->query('ServerContainer')->getURLGenerator()
                 );
             }
         );
         $container->registerService(
-           'AccessController',
+            'NotesController',
             function($c) {
-                 return new \OCA\Grauphel\Controller\AccessController(
+                return new \OCA\Grauphel\Controller\NotesController(
                     $c->query('AppName'),
-                    $c->query('Request')
+                    $c->query('Request'),
+                    $c->query('Session')->getUser()
                 );
             }
         );
         $container->registerService(
-           'OAuthController',
+            'TokenController',
             function($c) {
-                return new \OCA\Grauphel\Controller\OAuthController(
+                Dependencies::get()->urlGen
+                    = $c->query('ServerContainer')->getURLGenerator();
+                return new \OCA\Grauphel\Controller\TokenController(
                     $c->query('AppName'),
-                    $c->query('Request')
+                    $c->query('Request'),
+                    $c->query('Session')->getUser()
                 );
             }
         );