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:33:03 +0000 |
| commit | 33cde47e109f65dc27b989cb0194afcccfec9535 (patch) | |
| tree | a6452df1aee7038fd5903c4bcc8757f78c5dbff9 /bitbake | |
| parent | 1699870a0cf7b5ec3aadd9155cdca5dcf53ae273 (diff) | |
| download | poky-33cde47e109f65dc27b989cb0194afcccfec9535.tar.gz | |
bitbake: 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).
(Bitbake rev: 2d4439948a5328a9768bca9eaec221eb82af3cb2)
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
| -rw-r--r-- | bitbake/lib/hashserv/server.py | 2 | ||||
| -rw-r--r-- | bitbake/lib/hashserv/tests.py | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/bitbake/lib/hashserv/server.py b/bitbake/lib/hashserv/server.py index 8c3d20b651..439962f782 100644 --- a/bitbake/lib/hashserv/server.py +++ b/bitbake/lib/hashserv/server.py | |||
| @@ -709,7 +709,7 @@ class ServerClient(bb.asyncrpc.AsyncServerConnection): | |||
| 709 | "token": token, | 709 | "token": token, |
| 710 | } | 710 | } |
| 711 | 711 | ||
| 712 | @permissions(USER_ADMIN_PERM, allow_anon=False) | 712 | @permissions(USER_ADMIN_PERM, allow_self_service=True, allow_anon=False) |
| 713 | async def handle_delete_user(self, request): | 713 | async def handle_delete_user(self, request): |
| 714 | username = str(request["username"]) | 714 | username = str(request["username"]) |
| 715 | 715 | ||
diff --git a/bitbake/lib/hashserv/tests.py b/bitbake/lib/hashserv/tests.py index 5d209ffb87..f0be867915 100644 --- a/bitbake/lib/hashserv/tests.py +++ b/bitbake/lib/hashserv/tests.py | |||
| @@ -683,10 +683,13 @@ class HashEquivalenceCommonTests(object): | |||
| 683 | 683 | ||
| 684 | user = self.create_user("test-user", []) | 684 | user = self.create_user("test-user", []) |
| 685 | 685 | ||
| 686 | # No self service | 686 | # self service |
| 687 | with self.auth_client(user) as client, self.assertRaises(InvokeError): | 687 | with self.auth_client(user) as client: |
| 688 | client.delete_user(user["username"]) | 688 | client.delete_user(user["username"]) |
| 689 | 689 | ||
| 690 | self.assertIsNone(admin_client.get_user(user["username"])) | ||
| 691 | user = self.create_user("test-user", []) | ||
| 692 | |||
| 690 | with self.auth_perms() as client, self.assertRaises(InvokeError): | 693 | with self.auth_perms() as client, self.assertRaises(InvokeError): |
| 691 | client.delete_user(user["username"]) | 694 | client.delete_user(user["username"]) |
| 692 | 695 | ||
