basyx commited on
Commit
094b07f
·
verified ·
1 Parent(s): e932c62

sync: align runtime source with GitHub main

Browse files
Files changed (1) hide show
  1. app/security/scopes.py +22 -1
app/security/scopes.py CHANGED
@@ -89,7 +89,6 @@ DEFAULT_ROLE_SCOPES: dict[str, frozenset[str]] = {
89
  "jobs:cancel",
90
  "assets:read",
91
  "assets:write",
92
- "assets:delete",
93
  "mcp:read",
94
  "mcp:execute",
95
  "system:read",
@@ -250,3 +249,25 @@ def effective_scopes(
250
  if "admin" in scopes:
251
  return ALL_SCOPES
252
  return frozenset(scopes)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  "jobs:cancel",
90
  "assets:read",
91
  "assets:write",
 
92
  "mcp:read",
93
  "mcp:execute",
94
  "system:read",
 
249
  if "admin" in scopes:
250
  return ALL_SCOPES
251
  return frozenset(scopes)
252
+
253
+
254
+ def membership_role_scopes(
255
+ role: str | None,
256
+ overrides: Mapping[str, Sequence[str]] | None = None,
257
+ ) -> frozenset[str]:
258
+ """Return the tenant-membership permission ceiling.
259
+
260
+ Membership roles and API-key roles are separate vocabularies. Owners and
261
+ administrators receive the full membership ceiling; ordinary members and
262
+ service principals receive the operator ceiling; viewers remain read-only.
263
+ The API-key role/scopes are intersected with this ceiling at authorization.
264
+ """
265
+ normalized = (role or "").strip().lower()
266
+ roles = configured_roles(overrides)
267
+ if normalized in {"owner", "admin"}:
268
+ return ALL_SCOPES
269
+ if normalized in {"member", "service"}:
270
+ return roles.get("operator", DEFAULT_ROLE_SCOPES["operator"])
271
+ if normalized == "viewer":
272
+ return roles.get("viewer", DEFAULT_ROLE_SCOPES["viewer"])
273
+ return frozenset()