You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2018/08/21 18:47:09 UTC

[GitHub] mistercrunch commented on a change in pull request #5684: [security] Moving set/merge perm to security manager

mistercrunch commented on a change in pull request #5684: [security] Moving set/merge perm to security manager
URL: https://github.com/apache/incubator-superset/pull/5684#discussion_r211717894
 
 

 ##########
 File path: superset/security.py
 ##########
 @@ -383,3 +383,47 @@ def is_granter_pvm(self, pvm):
         return pvm.permission.name in {
             'can_override_role_permissions', 'can_approve',
         }
+
+    def set_perm(self, mapper, connection, target):  # noqa
+        if target.perm != target.get_perm():
+            link_table = target.__table__
+            connection.execute(
+                link_table.update()
+                .where(link_table.c.id == target.id)
+                .values(perm=target.get_perm()),
+            )
+
+        # add to view menu if not already exists
+        permission_name = 'datasource_access'
+        view_menu_name = target.get_perm()
+        permission = self.find_permission(permission_name)
+        view_menu = self.find_view_menu(view_menu_name)
+        pv = None
+
+        if not permission:
 
 Review comment:
   Hey I think we can get rid of most of this by calling `self.add_permission_view_menu` which takes care of all of this I think

----------------------------------------------------------------
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

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org