Skip to content

Commit c4f668d

Browse files
committed
refactor(rbac): use Role.is_org_admin property and fix empty scopes edge case
1 parent b672941 commit c4f668d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

tracecat/auth/credentials.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def compute_effective_scopes(role: Role) -> frozenset[str]:
114114
if role.workspace_id and role.workspace_role:
115115
# Org admins/owners already have workspace scopes via their org role
116116
# Regular members need their workspace role scopes
117-
if role.org_role not in (OrgRole.OWNER, OrgRole.ADMIN):
117+
if not role.is_org_admin:
118118
scope_set |= PRESET_ROLE_SCOPES.get(role.workspace_role, set())
119119

120120
# Note: Group-based scopes (from group_assignment table) will be added in PR 4

tracecat/authz/controls.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,10 @@ async def admin_operation(...):
272272
required = set(scopes)
273273

274274
def check_scopes():
275+
# Empty required scopes means no restrictions
276+
if not required:
277+
return
278+
275279
user_scopes = ctx_scopes.get()
276280

277281
# Platform superuser has "*" scope - bypass all checks

0 commit comments

Comments
 (0)