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 2018/09/12 15:25:25 UTC

[GitHub] XD-DENG closed pull request #3889: [AIRFLOW-3048] Add access to self-manage pages for non-Admin roles

XD-DENG closed pull request #3889: [AIRFLOW-3048] Add access to self-manage pages for non-Admin roles
URL: https://github.com/apache/incubator-airflow/pull/3889
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/airflow/www_rbac/security.py b/airflow/www_rbac/security.py
index 55570debf6..0e48d12776 100644
--- a/airflow/www_rbac/security.py
+++ b/airflow/www_rbac/security.py
@@ -130,6 +130,16 @@
     'can_dag_edit',
 }
 
+###########################################################################
+#         VIEW-PERMISSION COMBINATION FOR USER-SELF-MANAGEMENT
+###########################################################################
+
+user_self_manage_view_perms = {
+    'UserDBModelView': {'can_userinfo', 'resetmypassword', 'userinfoedit'},
+    'UserInfoEditView': {'can_this_form_post', 'can_this_form_get'},
+    'ResetMyPasswordView': {'can_this_form_post', 'can_this_form_get'}
+}
+
 ###########################################################################
 #                     DEFAULT ROLE CONFIGURATIONS
 ###########################################################################
@@ -183,6 +193,9 @@ def init_role(self, role_name, role_vms, role_perms):
         for pvm in pvms:
             if pvm.view_menu.name in role_vms and pvm.permission.name in role_perms:
                 role_pvms.append(pvm)
+            for view, perms in user_self_manage_view_perms.items():
+                if pvm.view_menu.name == view and pvm.permission.name in perms:
+                    role_pvms.append(pvm)
         role.permissions = list(set(role_pvms))
         self.get_session.merge(role)
         self.get_session.commit()


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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