diff options
author | Joshua Watt <JPEWhacker@gmail.com> | 2023-11-03 08:26:39 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-11-09 17:21:15 +0000 |
commit | 2d4439948a5328a9768bca9eaec221eb82af3cb2 (patch) | |
tree | 85727167c7100fec883d21eb81ba6f2183f27c7d /lib/hashserv | |
parent | 0e945d3dec02479df1157f48fd44223c2bfb34a3 (diff) | |
download | bitbake-2d4439948a5328a9768bca9eaec221eb82af3cb2.tar.gz |
hashserv: Allow self-service deletion
Allows users to self-service deletion of their own user accounts
(meaning, they can delete their own accounts without special
permissions).
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/hashserv')
-rw-r--r-- | lib/hashserv/server.py | 2 | ||||
-rw-r--r-- | lib/hashserv/tests.py | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/hashserv/server.py b/lib/hashserv/server.py index 8c3d20b65..439962f78 100644 --- a/lib/hashserv/server.py +++ b/lib/hashserv/server.py @@ -709,7 +709,7 @@ class ServerClient(bb.asyncrpc.AsyncServerConnection): "token": token, } - @permissions(USER_ADMIN_PERM, allow_anon=False) + @permissions(USER_ADMIN_PERM, allow_self_service=True, allow_anon=False) async def handle_delete_user(self, request): username = str(request["username"]) diff --git a/lib/hashserv/tests.py b/lib/hashserv/tests.py index 5d209ffb8..f0be86791 100644 --- a/lib/hashserv/tests.py +++ b/lib/hashserv/tests.py @@ -683,10 +683,13 @@ class HashEquivalenceCommonTests(object): user = self.create_user("test-user", []) - # No self service - with self.auth_client(user) as client, self.assertRaises(InvokeError): + # self service + with self.auth_client(user) as client: client.delete_user(user["username"]) + self.assertIsNone(admin_client.get_user(user["username"])) + user = self.create_user("test-user", []) + with self.auth_perms() as client, self.assertRaises(InvokeError): client.delete_user(user["username"]) |