Skip to content

Commit

Permalink
Limit the columns needed in create_dag_specific_permissions(), so mig…
Browse files Browse the repository at this point in the history
…ration 2c6edca13270 can work with the renamed column
  • Loading branch information
XD-DENG committed Mar 5, 2021
1 parent fc51e24 commit 52a0506
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions airflow/www/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,15 +474,16 @@ def create_dag_specific_permissions(self, session=None):
:return: None.
"""
perms = self.get_all_permissions()
dag_models = (
session.query(models.DagModel)
rows = (
session.query(models.DagModel.dag_id)
.filter(or_(models.DagModel.is_active, models.DagModel.is_paused))
.all()
)

for dag in dag_models:
for row in rows:
dag_id = row[0]
for perm_name in self.DAG_PERMS:
dag_resource_name = self.prefixed_dag_id(dag.dag_id)
dag_resource_name = self.prefixed_dag_id(dag_id)
if dag_resource_name and perm_name and (dag_resource_name, perm_name) not in perms:
self._merge_perm(perm_name, dag_resource_name)

Expand Down

0 comments on commit 52a0506

Please sign in to comment.