mirror of
https://git.yoctoproject.org/poky
synced 2026-01-29 21:08:42 +01:00
bitbake: hashserv: server: Add owner if user is logged in
If a user is authenticated with the server, report them as the owner of a report (Bitbake rev: a9fd4a45bb6e5ac9832835897f594f3bbf67e1aa) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
33cde47e10
commit
95481c8668
@@ -475,6 +475,9 @@ class ServerClient(bb.asyncrpc.AsyncServerConnection):
|
||||
if k in data:
|
||||
outhash_data[k] = data[k]
|
||||
|
||||
if self.user:
|
||||
outhash_data["owner"] = self.user.username
|
||||
|
||||
# Insert the new entry, unless it already exists
|
||||
if await self.db.insert_outhash(outhash_data):
|
||||
# If this row is new, check if it is equivalent to another
|
||||
|
||||
@@ -828,6 +828,15 @@ class HashEquivalenceCommonTests(object):
|
||||
for col in columns:
|
||||
self.client.remove({col: ""})
|
||||
|
||||
def test_auth_is_owner(self):
|
||||
admin_client = self.start_auth_server()
|
||||
|
||||
user = self.create_user("test-user", ["@read", "@report"])
|
||||
with self.auth_client(user) as client:
|
||||
taskhash, outhash, unihash = self.create_test_hash(client)
|
||||
data = client.get_taskhash(self.METHOD, taskhash, True)
|
||||
self.assertEqual(data["owner"], user["username"])
|
||||
|
||||
|
||||
class TestHashEquivalenceClient(HashEquivalenceTestSetup, unittest.TestCase):
|
||||
def get_server_addr(self, server_idx):
|
||||
|
||||
Reference in New Issue
Block a user