Enhance route access checks for PROXY_ADMIN_VIEW_ONLY role in RouteChecks class

- Added additional routes for key management operations to the access control logic.
- Improved handling of routes that start with "/key/" and end with "/regenerate" to ensure proper access restrictions.
This commit is contained in:
Jugal Bhatt 2025-08-13 16:04:43 -07:00
parent a74056e707
commit 3b47355449

View file

@ -405,7 +405,7 @@ class RouteChecks:
status_code=status.HTTP_403_FORBIDDEN,
detail=f"user not allowed to access this route, role= {_user_role}. Trying to access: {route} and updating invalid param: {param}. only user_email and password can be updated",
)
elif route in ["/user/new", "/user/delete", "/team/new", "/team/update", "/team/delete", "/model/new", "/model/update", "/model/delete"]:
elif route in ["/user/new", "/user/delete", "/team/new", "/team/update", "/team/delete", "/model/new", "/model/update", "/model/delete", "/key/generate", "/key/delete", "/key/update", "/key/regenerate", "/key/service-account/generate", "/key/block", "/key/unblock"] or route.startswith("/key/") and route.endswith("/regenerate"):
# Block write operations for PROXY_ADMIN_VIEW_ONLY
raise HTTPException(
status_code=status.HTTP_403_FORBIDDEN,