Spaces:
Sleeping
Sleeping
axeronis commited on
Commit ·
6e9be79
1
Parent(s): e8e789f
fix: allow superuser to update tenant settings
Browse files
backend/app/api/tenants.py
CHANGED
|
@@ -150,8 +150,8 @@ async def update_my_tenant(
|
|
| 150 |
Update current user's tenant settings.
|
| 151 |
Shortcut for PATCH /tenants/{tenant_id} using current user.
|
| 152 |
"""
|
| 153 |
-
# PERMISSION CHECK: Only OWNER can update settings
|
| 154 |
-
if current_user.role != UserRole.OWNER:
|
| 155 |
raise HTTPException(
|
| 156 |
status_code=status.HTTP_403_FORBIDDEN,
|
| 157 |
detail="Only OWNER can update settings. Managers have read-only access."
|
|
@@ -351,8 +351,8 @@ async def update_tenant(
|
|
| 351 |
Update tenant settings (AI configuration, business name, etc.).
|
| 352 |
OWNER ONLY - Managers cannot edit settings.
|
| 353 |
"""
|
| 354 |
-
# 1. PERMISSION CHECK: Only OWNER can update settings
|
| 355 |
-
if current_user.role != UserRole.OWNER:
|
| 356 |
raise HTTPException(
|
| 357 |
status_code=status.HTTP_403_FORBIDDEN,
|
| 358 |
detail="Only OWNER can update settings. Managers have read-only access."
|
|
|
|
| 150 |
Update current user's tenant settings.
|
| 151 |
Shortcut for PATCH /tenants/{tenant_id} using current user.
|
| 152 |
"""
|
| 153 |
+
# PERMISSION CHECK: Only OWNER or SUPERUSER can update settings
|
| 154 |
+
if current_user.role != UserRole.OWNER and not current_user.is_superuser:
|
| 155 |
raise HTTPException(
|
| 156 |
status_code=status.HTTP_403_FORBIDDEN,
|
| 157 |
detail="Only OWNER can update settings. Managers have read-only access."
|
|
|
|
| 351 |
Update tenant settings (AI configuration, business name, etc.).
|
| 352 |
OWNER ONLY - Managers cannot edit settings.
|
| 353 |
"""
|
| 354 |
+
# 1. PERMISSION CHECK: Only OWNER or SUPERUSER can update settings
|
| 355 |
+
if current_user.role != UserRole.OWNER and not current_user.is_superuser:
|
| 356 |
raise HTTPException(
|
| 357 |
status_code=status.HTTP_403_FORBIDDEN,
|
| 358 |
detail="Only OWNER can update settings. Managers have read-only access."
|