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 2019/01/07 21:41:44 UTC

[GitHub] timifasubaa closed pull request #5501: [WIP] add permissions check endpoint

timifasubaa closed pull request #5501: [WIP] add permissions check endpoint
URL: https://github.com/apache/incubator-superset/pull/5501
 
 
   

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/superset/views/core.py b/superset/views/core.py
index dc99345759..cf72a0b6d9 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -2568,6 +2568,25 @@ def csv(self, client_id):
         logging.info('Ready to return response')
         return response
 
+    @has_access
+    @expose('/usr_can_access_slice/<user>/<slice_id>')
+    @log_this
+    def user_can_access_slice(self, user, slice):
+        slc = db.session.query(models.Slice).filter_by(id=slice_id).first()
+        security_manager.has_access(slc.datasource)
+
+        if slice_id:
+            slc = (
+                db.session.query(models.Slice)
+                .filter_by(id=slice_id)
+                .one()
+            )
+            return security_manager.datasource_access(user=user, slc.get_viz().datasource)
+
+        #if the user does not exist, or slice does not exist, return error
+        #get the datasource corresponding to the slice
+        # check if it has access and return. 
+
     @has_access
     @expose('/fetch_datasource_metadata')
     @log_this


 

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