Skip to content

Commit

Permalink
[Alerts] Filter project resources by permissions for list (#5532)
Browse files Browse the repository at this point in the history
  • Loading branch information
yanburman committed May 8, 2024
1 parent e2b0d85 commit 2bd1a5d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion server/api/api/endpoints/alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,22 @@ async def list_alerts(
auth_info,
)

return await run_in_threadpool(
alerts = await run_in_threadpool(
server.api.crud.Alerts().list_alerts, db_session, project
)

alerts = await server.api.utils.auth.verifier.AuthVerifier().filter_project_resources_by_permissions(
mlrun.common.schemas.AuthorizationResourceTypes.alert,
alerts,
lambda alert: (
alert.project,
alert.name,
),
auth_info,
)

return alerts


@router.delete(
"/{name}",
Expand Down

0 comments on commit 2bd1a5d

Please sign in to comment.