Skip to content

Commit

Permalink
feat: Add environment variable to enable or disable authentication on…
Browse files Browse the repository at this point in the history
… role listing
  • Loading branch information
flavien-hugs committed Sep 18, 2024
1 parent 924482f commit 927d98e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/routers/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
Depends(AuthorizedHTTPBearer),
Depends(CheckPermissionsHandler(required_permissions={"auth:can-create-role"})),
]
if settings.LIST_ROLES_ENDPOINT_SECURITY_ENABLED
else []
),
response_model=Role,
summary="Create role",
Expand All @@ -36,10 +34,14 @@ async def create_role(payload: RoleModel = Body(...)):
@role_router.get(
"",
response_model=customize_page(Role),
dependencies=[
Depends(AuthorizedHTTPBearer),
Depends(CheckPermissionsHandler(required_permissions={"auth:can-display-role"})),
],
dependencies=(
[
Depends(AuthorizedHTTPBearer),
Depends(CheckPermissionsHandler(required_permissions={"auth:can-display-role"})),
]
if settings.LIST_ROLES_ENDPOINT_SECURITY_ENABLED
else []
),
summary="Get all roles",
status_code=status.HTTP_200_OK,
)
Expand Down

0 comments on commit 927d98e

Please sign in to comment.