timifasubaa closed pull request #4468: Make access request redirect to dashboard
URL: https://github.com/apache/incubator-superset/pull/4468
 
 
   

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/migrations/versions/e866bd2d4976_smaller_grid.py 
b/superset/migrations/versions/e866bd2d4976_smaller_grid.py
index e99c703479..ad996d4c4c 100644
--- a/superset/migrations/versions/e866bd2d4976_smaller_grid.py
+++ b/superset/migrations/versions/e866bd2d4976_smaller_grid.py
@@ -32,6 +32,8 @@ def upgrade():
 
     dashboards = session.query(Dashboard).all()
     for i, dashboard in enumerate(dashboards):
+        print('Upgrading ({}/{}): {}'.format(
+            i, len(dashboards), dashboard.id))
         positions = json.loads(dashboard.position_json or '{}')
         for pos in positions:
             if pos.get('v', 0) == 0:
@@ -44,8 +46,6 @@ def upgrade():
         dashboard.position_json = json.dumps(positions, indent=2)
         session.merge(dashboard)
         session.commit()
-        print('Upgraded ({}/{}): {}'.format(
-            i, len(dashboards), dashboard.dashboard_title))
 
     session.close()
 
@@ -56,6 +56,8 @@ def downgrade():
 
     dashboards = session.query(Dashboard).all()
     for i, dashboard in enumerate(dashboards):
+        print('Downgrading ({}/{}): {}'.format(
+            i, len(dashboards), dashboard.id))
         positions = json.loads(dashboard.position_json or '{}')
         for pos in positions:
             if pos.get('v', 0) == 1:
@@ -68,6 +70,4 @@ def downgrade():
         dashboard.position_json = json.dumps(positions, indent=2)
         session.merge(dashboard)
         session.commit()
-        print('Downgraded ({}/{}): {}'.format(
-            i, len(dashboards), dashboard.dashboard_title))
     pass
diff --git a/superset/views/core.py b/superset/views/core.py
index e5a6bf052f..e57cd7115e 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -842,6 +842,13 @@ def request_access(self):
                 .one()
             )
             datasources.add(datasource)
+
+        has_access = True
+        for datasource in datasources:
+            has_access |= (datasource and self.datasource_access(datasource))
+        if(has_access):
+            return redirect('/superset/dashboard/{}'.format(dashboard_id))
+
         if request.args.get('action') == 'go':
             for datasource in datasources:
                 access_request = DAR(


 

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to