pierrejeambrun commented on code in PR #47532:
URL: https://github.com/apache/airflow/pull/47532#discussion_r1991176970
##########
airflow/api_fastapi/core_api/routes/public/dag_run.py:
##########
@@ -303,18 +327,34 @@ def get_dag_runs(
This endpoint allows specifying `~` as the dag_id to retrieve Dag Runs for
all DAGs.
"""
+ # if readable_dags_filter.value is None:
+ # return DAGRunCollectionResponse(dag_runs=[], total_entries=0)
+
query = select(DagRun)
if dag_id != "~":
dag: DAG = request.app.state.dag_bag.get_dag(dag_id)
if not dag:
raise HTTPException(status.HTTP_404_NOT_FOUND, f"The DAG with
dag_id: `{dag_id}` was not found")
+ # if dag_id not in readable_dags_filter.value:
+ # raise HTTPException(status.HTTP_403_FORBIDDEN, f"Access to DAG
with dag_id: `{dag_id}` is forbidden")
+
query = query.filter(DagRun.dag_id == dag_id)
+ # else:
+ # query = query.filter(DagRun.dag_id.in_(readable_dags_filter.value))
Review Comment:
Edit, both are fine I think.
In the legacy implementation we reused -> cost of not plugin the filter into
the filter interface. We need to manually filter and modify the base query.
Otherwise you can create a new filter indeed as you did in comments. Maybe
that's cleaner.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]