Let each tenant create named API keys with content and visibility scope.
Deploy Development / deploy (push) Failing after 32s
Test Suite / pytest-backend (push) Failing after 26s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Failing after 6s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Canceled after 1m34s
Deploy Development / deploy (push) Failing after 32s
Test Suite / pytest-backend (push) Failing after 26s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Failing after 6s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Canceled after 1m34s
Superadmins enable a club for the interface. Club admins and members create the keys. Exercise release lives on its own tab and picks one of those keys. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
fe3633ba8b
commit
1527a430b9
14 files changed
+842
-290
No files matched your search
@@ -286,6 +286,37 @@ def can_withdraw(*, role: Optional[str], denial: Optional[str]) -> bool:
|
||||
return denial is None
|
||||
|
||||
|
||||
OBJECT_SCOPES = ("exercise", "training_plan", "framework", "training_module")
|
||||
CONTEXT_VISIBILITIES = {
|
||||
"platform": ("official", "private"),
|
||||
"club": ("club", "private"),
|
||||
"personal": ("private",),
|
||||
}
|
||||
|
||||
|
||||
def scope_denial(context_kind: str, objects: Iterable[str], visibilities: Iterable[str]) -> Optional[str]:
|
||||
allowed = CONTEXT_VISIBILITIES.get(context_kind)
|
||||
if allowed is None:
|
||||
return "Unbekannter Schlüsselkontext."
|
||||
chosen_objects = [str(item) for item in objects]
|
||||
chosen_visibilities = [str(item) for item in visibilities]
|
||||
if not chosen_objects:
|
||||
return "Der Schlüssel braucht mindestens eine Objektart."
|
||||
if any(item not in OBJECT_SCOPES for item in chosen_objects):
|
||||
return "Unbekannte Objektart."
|
||||
if not chosen_visibilities:
|
||||
return "Der Schlüssel braucht mindestens eine Sichtbarkeit."
|
||||
if any(item not in allowed for item in chosen_visibilities):
|
||||
return "Diese Sichtbarkeit ist in diesem Kontext nicht erlaubt."
|
||||
return None
|
||||
|
||||
|
||||
def key_covers(objects: Optional[Iterable[str]], visibilities: Optional[Iterable[str]], *, resource: str, visibility: str) -> bool:
|
||||
chosen_objects = list(objects) if objects else ["exercise"]
|
||||
chosen_visibilities = list(visibilities) if visibilities else ["official", "club", "private"]
|
||||
return resource in chosen_objects and visibility in chosen_visibilities
|
||||
|
||||
|
||||
def package_state(*, fetch_blocked: bool, retired: bool) -> str:
|
||||
if fetch_blocked:
|
||||
return "withdrawn"
|
||||
|
||||
Reference in new issue
Block a user