ashb commented on code in PR #23510:
URL: https://github.com/apache/airflow/pull/23510#discussion_r866782962
##########
airflow/www/security.py:
##########
@@ -340,7 +340,15 @@ def get_accessible_dag_ids(self, user, user_actions=None,
session=None) -> Set[s
def can_access_some_dags(self, action: str, dag_id: Optional[str] = None)
-> bool:
"""Checks if user has read or write access to some dags."""
if dag_id and dag_id != '~':
- return self.has_access(action,
permissions.resource_name_for_dag(dag_id))
+ is_subdag = False
+ dm = (
+ self.get_session.query(DagModel.dag_id, DagModel.is_subdag)
+ .filter(DagModel.dag_id == dag_id)
+ .first()
+ )
+ if dm:
+ is_subdag = dm.is_subdag
Review Comment:
We can do this query _only_ when there's a `.` in the name. If there's no
dot we know don't have to hit the DB, as it can't be a subdag.
--
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]