Add token management page (only shows tokens for now)
authorChristian Weiske <cweiske@cweiske.de>
Sat, 27 Sep 2014 09:09:44 +0000 (11:09 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Sat, 27 Sep 2014 09:09:44 +0000 (11:09 +0200)
appinfo/routes.php
controller/guicontroller.php
templates/tokens.php [new file with mode: 0644]

index d4a8cd646b67347ff47e54f0635bd662b0e4b50f..a82db6b69c4794991f3579c922194046134dc32e 100644 (file)
@@ -68,6 +68,11 @@ $application->registerRoutes(
                 'name' => 'gui#tag',
                 'verb' => 'GET',
             ),
                 'name' => 'gui#tag',
                 'verb' => 'GET',
             ),
+            array(
+                'url'  => '/tokens',
+                'name' => 'gui#tokens',
+                'verb' => 'GET',
+            ),
         )
     )
 );
         )
     )
 );
index 1a4d0233cdeb002726b3c391037a29c3585bda7f..3c9c6f1f2a99b5d18d3a430dfbe33beceeaa20a1 100644 (file)
@@ -15,6 +15,7 @@ namespace OCA\Grauphel\Controller;
 
 use \OCP\AppFramework\Controller;
 use \OCP\AppFramework\Http\TemplateResponse;
 
 use \OCP\AppFramework\Controller;
 use \OCP\AppFramework\Http\TemplateResponse;
+use \OCA\Grauphel\Lib\TokenStorage;
 
 /**
  * Owncloud frontend
 
 /**
  * Owncloud frontend
@@ -93,6 +94,28 @@ class GuiController extends Controller
         return $res;
     }
 
         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'
+                )
+            )
+        );
+        $this->addNavigation($res, $rawtag);
+
+        return $res;
+    }
+
     protected function addNavigation(TemplateResponse $res, $selectedRawtag = null)
     {
         $nav = new \OCP\Template('grauphel', 'appnavigation', '');
     protected function addNavigation(TemplateResponse $res, $selectedRawtag = null)
     {
         $nav = new \OCP\Template('grauphel', 'appnavigation', '');
diff --git a/templates/tokens.php b/templates/tokens.php
new file mode 100644 (file)
index 0000000..531883d
--- /dev/null
@@ -0,0 +1,13 @@
+<link rel="stylesheet" href="<?php p(OCP\Util::linkTo('grauphel','grauphel.css')); ?>" type="text/css"/>
+
+<?php /** @var $l OC_L10N */ ?>
+<?php $_['appNavigation']->printPage(); ?>
+
+<div id="app-content">
+  <h1>Manage access tokens</h1>
+  <ul>
+    <?php foreach ($_['tokens'] as $token) { ?>
+      <li data-id="<?php p($token->tokenKey); ?>"><a href="#"><?php p($token->tokenKey); ?></a></li>
+    <?php } ?>
+  </ul>
+</div>