You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@superset.apache.org by gi...@git.apache.org on 2017/09/17 20:44:37 UTC

[GitHub] dmigo commented on a change in pull request #3404: Feature: "Impersonate user" setting on Datasource

dmigo commented on a change in pull request #3404: Feature: "Impersonate user" setting on Datasource
URL: https://github.com/apache/incubator-superset/pull/3404#discussion_r139320827
 
 

 ##########
 File path: superset/models/core.py
 ##########
 @@ -588,13 +589,15 @@ def set_sqlalchemy_uri(self, uri):
         conn.password = password_mask if conn.password else None
         self.sqlalchemy_uri = str(conn)  # hides the password
 
-    def get_sqla_engine(self, schema=None, nullpool=False):
+    def get_sqla_engine(self, schema=None, nullpool=False, user_name=None):
         extra = self.get_extra()
         uri = make_url(self.sqlalchemy_uri_decrypted)
         params = extra.get('engine_params', {})
         if nullpool:
             params['poolclass'] = NullPool
         uri = self.db_engine_spec.adjust_database_uri(uri, schema)
+        if self.impersonate_user:
+            uri.username = user_name if user_name != None else g.user.username
 
 Review comment:
   done! ? 
 
----------------------------------------------------------------
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