diff --git a/src/Wallabag/CoreBundle/Controller/DeveloperController.php b/src/Wallabag/CoreBundle/Controller/DeveloperController.php index 30cc8bebd..e77203556 100644 --- a/src/Wallabag/CoreBundle/Controller/DeveloperController.php +++ b/src/Wallabag/CoreBundle/Controller/DeveloperController.php @@ -17,13 +17,17 @@ class DeveloperController extends Controller */ public function indexAction() { - return $this->render('WallabagCoreBundle:Developer:index.html.twig'); + $clients = $this->getDoctrine()->getRepository('WallabagApiBundle:Client')->findAll(); + + return $this->render('WallabagCoreBundle:Developer:index.html.twig', array( + 'clients' => $clients, + )); } /** * @param Request $request * - * @Route("/developer/client/create", name="create_client") + * @Route("/developer/client/create", name="developer_create_client") * * @return \Symfony\Component\HttpFoundation\Response */ @@ -56,7 +60,30 @@ class DeveloperController extends Controller } /** - * @Route("/developer/howto/first-app", name="howto-firstapp") + * Remove a client. + * + * @param Request $request + * + * @Route("/developer/client/delete/{id}", requirements={"id" = "\d+"}, name="developer_delete_client") + * + * @return \Symfony\Component\HttpFoundation\RedirectResponse + */ + public function deleteClientAction(Request $request, Client $client) + { + $em = $this->getDoctrine()->getManager(); + $em->remove($client); + $em->flush(); + + $this->get('session')->getFlashBag()->add( + 'notice', + 'Client deleted' + ); + + return $this->redirect($this->generateUrl('developer')); + } + + /** + * @Route("/developer/howto/first-app", name="developer_howto_firstapp") * * @return \Symfony\Component\HttpFoundation\Response */ diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client_parameters.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client_parameters.html.twig index a2a28d508..c2f7e95c4 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client_parameters.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/client_parameters.html.twig @@ -8,14 +8,13 @@
{% trans %}Here are your client parameters.{% endtrans %}
-{% trans %}Make sure to copy these parameters now. You won’t be able to see them again!{% endtrans %}
{{ client_id }}
{{ client_secret }}
The following commands make use of the HTTPie library. Make sure it is installed on your system before using it.
You need a token to communicate between your 3rd application and wallabag API.
-To create this token, you need to create a new client.
+To create this token, you need to create a new client.
Now, create your token (replace client_id, client_secret, username and password with the good values):
http POST http://v2.wallabag.org/oauth/v2/token \
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/index.html.twig
index 87dd4a5fe..604bfec9c 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/index.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Developer/index.html.twig
@@ -13,15 +13,52 @@
{% trans %}Documentation{% endtrans %}
- - {% trans %}How to create my first application{% endtrans %}
+ - {% trans %}How to create my first application{% endtrans %}
- {% trans %}View full API documentation{% endtrans %}
{% trans %}Clients{% endtrans %}
+ {% trans %}Existing clients{% endtrans %}
+ {% if clients %}
+
+ {% for client in clients %}
+ -
+ #{{ client.id }}
+
+
+
+ {% trans %}Client ID:{% endtrans %}
+ {{ client.id }}_{{ client.randomId }}
+
+
+ {% trans %}Client secret:{% endtrans %}
+ {{ client.secret }}
+
+
+ {% trans %}Redirect URIs:{% endtrans %}
+ {{ client.redirectUris|json_encode() }}
+
+
+ {% trans %}Grant type allowed:{% endtrans %}
+ {{ client.allowedGrantTypes|json_encode() }}
+
+
+
+ {% trans %}You have the ability to remove this client. This action is IRREVERSIBLE !{% endtrans %}
+ {% trans %}If you remove it, every app configured with that client won't be able to auth on your wallabag.{% endtrans %}
+ {% trans %}Remove this client{% endtrans %}
+
+
+
+ {% endfor %}
+
+ {% else %}
+ {% trans %}No client yet.{% endtrans %}
+ {% endif %}
{% trans %}Here are your client parameters.{% endtrans %}
-{% trans %}Make sure to copy these parameters now. You won’t be able to see them again!{% endtrans %}
{{ client_id }}
{{ client_secret }}
The following commands make use of the HTTPie library. Make sure it is installed on your system before using it.
You need a token to communicate between your 3rd application and wallabag API.
-To create this token, you need to create a new client.
+To create this token, you need to create a new client.
Now, create your token (replace client_id, client_secret, username and password with the good values):
http POST http://v2.wallabag.org/oauth/v2/token \
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig
index 87dd4a5fe..604bfec9c 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Developer/index.html.twig
@@ -13,15 +13,52 @@
{% trans %}Documentation{% endtrans %}
- - {% trans %}How to create my first application{% endtrans %}
+ - {% trans %}How to create my first application{% endtrans %}
- {% trans %}View full API documentation{% endtrans %}
{% trans %}Clients{% endtrans %}
+ {% trans %}Existing clients{% endtrans %}
+ {% if clients %}
+
+ {% for client in clients %}
+ -
+ #{{ client.id }}
+
+
+
+ {% trans %}Client ID:{% endtrans %}
+ {{ client.id }}_{{ client.randomId }}
+
+
+ {% trans %}Client secret:{% endtrans %}
+ {{ client.secret }}
+
+
+ {% trans %}Redirect URIs:{% endtrans %}
+ {{ client.redirectUris|json_encode() }}
+
+
+ {% trans %}Grant type allowed:{% endtrans %}
+ {{ client.allowedGrantTypes|json_encode() }}
+
+
+
+ {% trans %}You have the ability to remove this client. This action is IRREVERSIBLE !{% endtrans %}
+ {% trans %}If you remove it, every app configured with that client won't be able to auth on your wallabag.{% endtrans %}
+ {% trans %}Remove this client{% endtrans %}
+
+
+
+ {% endfor %}
+
+ {% else %}
+ {% trans %}No client yet.{% endtrans %}
+ {% endif %}