diff options
Diffstat (limited to 'bitbake/lib')
| -rw-r--r-- | bitbake/lib/hashserv/server.py | 3 | ||||
| -rw-r--r-- | bitbake/lib/hashserv/tests.py | 9 |
2 files changed, 12 insertions, 0 deletions
diff --git a/bitbake/lib/hashserv/server.py b/bitbake/lib/hashserv/server.py index 439962f782..a86507830e 100644 --- a/bitbake/lib/hashserv/server.py +++ b/bitbake/lib/hashserv/server.py | |||
| @@ -475,6 +475,9 @@ class ServerClient(bb.asyncrpc.AsyncServerConnection): | |||
| 475 | if k in data: | 475 | if k in data: |
| 476 | outhash_data[k] = data[k] | 476 | outhash_data[k] = data[k] |
| 477 | 477 | ||
| 478 | if self.user: | ||
| 479 | outhash_data["owner"] = self.user.username | ||
| 480 | |||
| 478 | # Insert the new entry, unless it already exists | 481 | # Insert the new entry, unless it already exists |
| 479 | if await self.db.insert_outhash(outhash_data): | 482 | if await self.db.insert_outhash(outhash_data): |
| 480 | # If this row is new, check if it is equivalent to another | 483 | # If this row is new, check if it is equivalent to another |
diff --git a/bitbake/lib/hashserv/tests.py b/bitbake/lib/hashserv/tests.py index f0be867915..a9e6fdf9ff 100644 --- a/bitbake/lib/hashserv/tests.py +++ b/bitbake/lib/hashserv/tests.py | |||
| @@ -828,6 +828,15 @@ class HashEquivalenceCommonTests(object): | |||
| 828 | for col in columns: | 828 | for col in columns: |
| 829 | self.client.remove({col: ""}) | 829 | self.client.remove({col: ""}) |
| 830 | 830 | ||
| 831 | def test_auth_is_owner(self): | ||
| 832 | admin_client = self.start_auth_server() | ||
| 833 | |||
| 834 | user = self.create_user("test-user", ["@read", "@report"]) | ||
| 835 | with self.auth_client(user) as client: | ||
| 836 | taskhash, outhash, unihash = self.create_test_hash(client) | ||
| 837 | data = client.get_taskhash(self.METHOD, taskhash, True) | ||
| 838 | self.assertEqual(data["owner"], user["username"]) | ||
| 839 | |||
| 831 | 840 | ||
| 832 | class TestHashEquivalenceClient(HashEquivalenceTestSetup, unittest.TestCase): | 841 | class TestHashEquivalenceClient(HashEquivalenceTestSetup, unittest.TestCase): |
| 833 | def get_server_addr(self, server_idx): | 842 | def get_server_addr(self, server_idx): |
