ephraimbuddy commented on code in PR #34355:
URL: https://github.com/apache/airflow/pull/34355#discussion_r1325498761


##########
airflow/api_connexion/endpoints/dag_warning_endpoint.py:
##########
@@ -57,12 +59,20 @@ def get_dag_warnings(
     allowed_filter_attrs = ["dag_id", "warning_type", "message", "timestamp"]
     query = select(DagWarningModel)
     if dag_id:
+        if not get_airflow_app().appbuilder.sm.can_read_dag(dag_id, g.user):
+            raise PermissionDenied(detail=f"User not allowed to access this 
DAG: {dag_id}")
         query = query.where(DagWarningModel.dag_id == dag_id)
     if warning_type:
         query = query.where(DagWarningModel.warning_type == warning_type)
-    total_entries = get_query_count(query, session=session)
     query = apply_sorting(query=query, order_by=order_by, 
allowed_attrs=allowed_filter_attrs)
     dag_warnings = session.scalars(query.offset(offset).limit(limit)).all()
+    if not dag_id:
+        dag_warnings = [
+            dag_warning
+            for dag_warning in dag_warnings
+            if 
get_airflow_app().appbuilder.sm.can_read_dag(dag_warning.dag_id, g.user)
+        ]
+    total_entries = len(dag_warnings)

Review Comment:
   Yeah. This is the total not paginated



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