Another fix for bug #10
[grauphel.git] / controller / guicontroller.php
index 1a4d0233cdeb002726b3c391037a29c3585bda7f..0cb8e913ffeb95988bdfe58c6e89b11313309dcf 100644 (file)
@@ -15,6 +15,8 @@ namespace OCA\Grauphel\Controller;
 
 use \OCP\AppFramework\Controller;
 use \OCP\AppFramework\Http\TemplateResponse;
+use \OCA\Grauphel\Lib\Client;
+use \OCA\Grauphel\Lib\TokenStorage;
 
 /**
  * Owncloud frontend
@@ -93,10 +95,34 @@ class GuiController extends Controller
         return $res;
     }
 
+    /**
+     * Show access tokens
+     *
+     * @NoAdminRequired
+     * @NoCSRFRequired
+     */
+    public function tokens()
+    {
+        $tokens = new TokenStorage();
+        $res = new TemplateResponse('grauphel', 'tokens');
+        $res->setParams(
+            array(
+                'tokens' => $tokens->loadForUser(
+                    $this->user->getUid(), 'access'
+                ),
+                'client' => new Client(),
+            )
+        );
+        $this->addNavigation($res, null);
+
+        return $res;
+    }
+
     protected function addNavigation(TemplateResponse $res, $selectedRawtag = null)
     {
         $nav = new \OCP\Template('grauphel', 'appnavigation', '');
         $nav->assign('apiroot', $this->getApiRootUrl());
+        $nav->assign('tags', array());
 
         $params = $res->getParams();
         $params['appNavigation'] = $nav;