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 2021/07/28 16:35:54 UTC

[GitHub] [superset] prachir1501 commented on issue #15066: Permissions issue with superset- DataSource

prachir1501 commented on issue #15066:
URL: https://github.com/apache/superset/issues/15066#issuecomment-888453718


   I have figured out a workaround as follows (for the charts) -
   In the file `superset/lib/python3.6/site-packages/superset/views/chart/views.py`,
    we can modify the add function as follows-
   ```
   def add(self) -> FlaskResponse:
       from flask import g
       from superset.views.utils import bootstrap_user_data
       temp = ConnectorRegistry.get_all_datasources(db.session)
       temp2 = []
       for d in temp:
           if(str(d.created_by) == str(g.user)):
               temp2.append(d)
   
       datasources = [
           {"value": str(d.id) + "__" + d.type, "label": repr(d)}
           for d in temp2
       ]
   
       payload = {
           "datasources": sorted(datasources, key=lambda d: d["label"]),
           "common": common_bootstrap_payload(),
           "user": bootstrap_user_data(g.user),
       }
       return self.render_template(
           "superset/add_slice.html", bootstrap_data=json.dumps(payload)
       )
   ```


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

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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