Skip to content

Commit 005f3b4

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

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
@@ -113,7 +113,7 @@ def compute_effective_scopes(role: Role) -> frozenset[str]:
113113
if role.workspace_id and role.workspace_role:
114114
# Org admins/owners already have workspace scopes via their org role
115115
# Regular members need their workspace role scopes
116-
if role.org_role not in (OrgRole.OWNER, OrgRole.ADMIN):
116+
if not role.is_org_admin:
117117
scope_set |= PRESET_ROLE_SCOPES.get(role.workspace_role, set())
118118

119119
# 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
@@ -264,6 +264,10 @@ async def admin_operation(...):
264264
required = set(scopes)
265265

266266
def check_scopes():
267+
# Empty required scopes means no restrictions
268+
if not required:
269+
return
270+
267271
user_scopes = ctx_scopes.get()
268272

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

0 commit comments

Comments
 (0)