jhtimmins commented on a change in pull request #9973:
URL: https://github.com/apache/airflow/pull/9973#discussion_r614881677



##########
File path: airflow/www/security.py
##########
@@ -347,19 +347,23 @@ def can_read_dag(self, dag_id, user=None) -> bool:
         if not user:
             user = g.user
         prefixed_dag_id = self.prefixed_dag_id(dag_id)
-        return self._has_view_access(
-            user, permissions.ACTION_CAN_READ, permissions.RESOURCE_DAG
-        ) or self._has_view_access(user, permissions.ACTION_CAN_READ, 
prefixed_dag_id)
+        return (
+            self._has_view_access(user, permissions.ACTION_CAN_READ, 
permissions.RESOURCE_DAG)
+            or self._has_view_access(user, permissions.ACTION_CAN_READ, 
prefixed_dag_id)
+            or False
+        )
 
     def can_edit_dag(self, dag_id, user=None) -> bool:
         """Determines whether a user has DAG edit access."""
         if not user:
             user = g.user
         prefixed_dag_id = self.prefixed_dag_id(dag_id)
 
-        return self._has_view_access(
-            user, permissions.ACTION_CAN_EDIT, permissions.RESOURCE_DAG
-        ) or self._has_view_access(user, permissions.ACTION_CAN_EDIT, 
prefixed_dag_id)
+        return (
+            self._has_view_access(user, permissions.ACTION_CAN_EDIT, 
permissions.RESOURCE_DAG)
+            or self._has_view_access(user, permissions.ACTION_CAN_EDIT, 
prefixed_dag_id)
+            or False

Review comment:
       I have a PR that wraps `_has_view_access` (we're changing the naming 
from `view` and `permission` to `resource` and `action`). We can just bake sure 
the output of the `_has_access()` wrapping function returns a boolean.
   
   
https://github.com/apache/airflow/pull/15398/files#diff-9230f8648061da203f769faa144f992581fe146a271233b2874a522bd63544aaR441
 




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to