huymq1710 commented on code in PR #30340:
URL: https://github.com/apache/airflow/pull/30340#discussion_r1150072869
##########
airflow/models/dagbag.py:
##########
@@ -682,29 +682,12 @@ def sync_to_db(self, processor_subdir: str | None = None,
session: Session = NEW
@classmethod
@provide_session
def _sync_perm_for_dag(cls, dag: DAG, session: Session = NEW_SESSION):
- """Sync DAG specific permissions, if necessary"""
- from airflow.security.permissions import DAG_ACTIONS,
resource_name_for_dag
- from airflow.www.fab_security.sqla.models import Action, Permission,
Resource
+ """Sync DAG specific permissions"""
root_dag_id = dag.parent_dag.dag_id if dag.parent_dag else dag.dag_id
- def needs_perms(dag_id: str) -> bool:
- dag_resource_name = resource_name_for_dag(dag_id)
- for permission_name in DAG_ACTIONS:
- if not (
- session.query(Permission)
- .join(Action)
- .join(Resource)
- .filter(Action.name == permission_name)
- .filter(Resource.name == dag_resource_name)
- .one_or_none()
- ):
- return True
- return False
-
- if dag.access_control or needs_perms(root_dag_id):
Review Comment:
Remove this if block completely so we sync perms in both cases. This is
effectively reverting https://github.com/apache/airflow/pull/15464.
--
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]