gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] branch master updated: cli: implement 'users self' subcommand


From: gnunet
Subject: [libeufin] branch master updated: cli: implement 'users self' subcommand
Date: Sat, 07 Aug 2021 13:13:31 +0200

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new 0a4f8f5  cli: implement 'users self' subcommand
0a4f8f5 is described below

commit 0a4f8f53f84ad7e172880e0880a670aa651a01a4
Author: Florian Dold <florian@dold.me>
AuthorDate: Sat Aug 7 13:13:26 2021 +0200

    cli: implement 'users self' subcommand
---
 cli/bin/libeufin-cli                                     | 13 +++++++++++++
 nexus/src/main/kotlin/tech/libeufin/nexus/server/JSON.kt |  2 +-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/cli/bin/libeufin-cli b/cli/bin/libeufin-cli
index fd7bc94..b827a78 100755
--- a/cli/bin/libeufin-cli
+++ b/cli/bin/libeufin-cli
@@ -86,6 +86,19 @@ def users(ctx):
 def permissions(ctx):
     ctx.obj = NexusContext()
 
+@users.command("self", help="Show information about authenticated user.")
+@click.pass_obj
+def users_self(obj):
+    url = urljoin(obj.nexus_base_url, f"/user")
+    try:
+        resp = get(url, auth=auth.HTTPBasicAuth(obj.nexus_username, 
obj.nexus_password))
+    except Exception as e:
+        print(e)
+        print("Could not reach nexus at " + url)
+        exit(1)
+
+    tell_user(resp, withsuccess=True)
+    check_response_status(resp)
 
 @users.command("list", help="List users")
 @click.pass_obj
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/server/JSON.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/server/JSON.kt
index cf442fe..2c46699 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/server/JSON.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/server/JSON.kt
@@ -288,7 +288,7 @@ data class PaymentInitiationResponse(
 /** Response type of "GET /user" */
 data class UserResponse(
     val username: String,
-    val superuser: Boolean
+    val superuser: Boolean,
 )
 
 /** Request type of "POST /users" */

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]