Let one API key carry every area the holder may still grant.
Deploy Development / deploy (push) Successful in 53s
Test Suite / pytest-backend (push) Failing after 29s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Successful in 17s
Test Suite / k6 /health Baseline (push) Successful in 35s
Test Suite / playwright-tests (push) Failing after 7m49s

A key belongs to one application and can include global exercises, several clubs, and the holder's own exercises. Lost roles stop that area from being delivered, and the key stays copyable.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-11-23 14:25:57 +01:00
1 parent c08c7c65b5
commit b824115e9b
7 files changed
+260 -111

No files matched your search

+9 -5
View File
@@ -126,8 +126,9 @@ class AccessKeyBody(BaseModel):
name: str = Field(min_length=1, max_length=200)
objects: list[str]
visibilities: list[str]
context_kind: str
context_kind: str = "user"
club_id: Optional[int] = None
club_ids: list[int] = []
class ClubApiBody(BaseModel):
@@ -168,7 +169,7 @@ def get_changes(
raise exc
with get_db() as conn:
cur = get_cursor(conn)
payload = list_changes(cur, binding["recipient_id"], seq, limit)
payload = list_changes(cur, binding["recipient_id"], seq, limit, binding)
return Response(
content=__import__("json").dumps(payload, ensure_ascii=False, separators=(",", ":")),
media_type="application/json",
@@ -185,7 +186,9 @@ def get_availability(source_id: str, authorization: Optional[str] = Header(defau
cur = get_cursor(conn)
try:
assert_exercise_object(binding.get("objects"))
payload = load_availability(cur, binding["recipient_id"], source_id, binding.get("visibilities"))
payload = load_availability(
cur, binding["recipient_id"], source_id, binding.get("visibilities"), binding
)
except HTTPException as exc:
held = exc
if held is not None:
@@ -207,7 +210,7 @@ def get_release(release_id: str, authorization: Optional[str] = Header(default=N
cur = get_cursor(conn)
try:
assert_exercise_object(binding.get("objects"))
body = load_manifest(cur, binding["recipient_id"], release_id, binding.get("visibilities"))
body = load_manifest(cur, binding["recipient_id"], release_id, binding.get("visibilities"), binding)
except HTTPException as exc:
held = exc
if held is not None:
@@ -227,7 +230,7 @@ def get_asset(release_id: str, asset_id: str, authorization: Optional[str] = Hea
try:
assert_exercise_object(binding.get("objects"))
path, media_type = load_asset(
cur, binding["recipient_id"], release_id, asset_id, binding.get("visibilities")
cur, binding["recipient_id"], release_id, asset_id, binding.get("visibilities"), binding
)
except HTTPException as exc:
held = exc
@@ -524,6 +527,7 @@ def post_access_key(body: AccessKeyBody, tenant: TenantContext = Depends(get_ten
visibilities=body.visibilities,
context_kind=body.context_kind,
club_id=body.club_id,
club_ids=body.club_ids,
profile_id=tenant.profile_id,
role=tenant.global_role or "",
)