You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2019/09/27 16:35:05 UTC
[GitHub] [airflow] feng-tao commented on a change in pull request #6199:
[AIRFLOW-5562] Skip grant single DAG permissions for Admin role.
feng-tao commented on a change in pull request #6199: [AIRFLOW-5562] Skip grant single DAG permissions for Admin role.
URL: https://github.com/apache/airflow/pull/6199#discussion_r329156620
##########
File path: airflow/www/security.py
##########
@@ -453,12 +453,19 @@ def merge_pv(perm, view_menu):
def update_admin_perm_view(self):
"""
- Admin should have all the permission-views.
+ Admin should have all the permission-views, except the dag views.
+ because Admin have already have all_dags permission.
Add the missing ones to the table for admin.
:return: None.
"""
- pvms = self.get_session.query(sqla_models.PermissionView).all()
+ all_dag_view = self.find_view_menu('all_dags')
+ dag_perm_ids = [self.find_permission('can_dag_edit').id, self.find_permission('can_dag_read').id]
+ pvms = self.get_session.query(sqla_models.PermissionView).filter(~and_(
+ sqla_models.PermissionView.permission_id.in_(dag_perm_ids),
+ sqla_models.PermissionView.view_menu_id != all_dag_view.id)
+ ).all()
Review comment:
@XD-DENG I need to take a deeper look, but the initial idea is to add all the permissions with views to Admin(not just those dag related). If we are going to add single view-menu(`all_dags`) to Admin, we need to add the rest to Admin(or it has been handled inside FAB which I am not sure) as well otherwise Admin will miss bunches of permissions staffs.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services