rawwar commented on code in PR #47532:
URL: https://github.com/apache/airflow/pull/47532#discussion_r1991172371


##########
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:
   We need to use a different Model; if you notice, PermittedDagRunFilter is 
using the DagRun model.
   
   Because of this, direct filters aren't working. I had to do something like 
below 
   
   `query = query.filter(DagRun.dag_id.in_(readable_dags_filter.value))`



-- 
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]

Reply via email to