about summary refs log tree commit diff
diff options
context:
space:
mode:
authorClaude Sonnet 4.6 <noreply@anthropic.com>2026-08-28 20:00:00 +0000
committerFrederick Muriuki Muriithi <fredmanglis@gmail.com>2026-08-28 15:04:53 -0500
commit41e8ccb5fd350f4046ef7ddef873490667bd08b7 (patch)
tree430f13a462accff2f84a4a4dc95d6e6c085c283e
parent011f6477da2cfc9f05525a058b989e14e70df42b (diff)
downloadgenenetwork3-41e8ccb5fd350f4046ef7ddef873490667bd08b7.tar.gz
Fix __population_privileges__: pass Bearer token to resource roles endpoint
GET /auth/resource/<id>/roles requires authentication.  The call was made
without an Authorization header, so the auth server always returned an error
and resource_privs was always an empty tuple.  The resource_spec branch of
can_edit (gn_libs.privileges.resources) was therefore permanently unreachable,
meaning resource-owners could never edit case attributes via their role.

The system roles call on the line below correctly forwarded the bearer token;
this applies the same pattern to the resource roles call.

Reviewed-By: Frederick M. Muriithi <fredmanglis@gmail.com>
-rw-r--r--gn3/api/case_attributes.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/gn3/api/case_attributes.py b/gn3/api/case_attributes.py
index 9c10b8a..c97c79e 100644
--- a/gn3/api/case_attributes.py
+++ b/gn3/api/case_attributes.py
@@ -316,6 +316,7 @@ def __population_privileges__(
         resource_id = res_id_resp.json()["resource-id"]
         roles_resp = requests.get(
             urljoin(auth_url, f"auth/resource/{resource_id}/roles"),
+            headers={"Authorization": bearer},
             timeout=300)
         if roles_resp.status_code == 200:
             resource_privs = tuple(