You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by be...@apache.org on 2018/12/18 18:56:04 UTC

[incubator-superset] branch master updated: Pass security manager to QUERY_LOGGER (#6548)

This is an automated email from the ASF dual-hosted git repository.

beto pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 672c470  Pass security manager to QUERY_LOGGER (#6548)
672c470 is described below

commit 672c470e79797290c96c61a0ee05788143f32736
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Tue Dec 18 10:55:58 2018 -0800

    Pass security manager to QUERY_LOGGER (#6548)
    
    * Pass security manager to log_query
    
    * Fix lint
---
 superset/config.py      | 9 ++++++++-
 superset/models/core.py | 2 +-
 superset/sql_lab.py     | 1 +
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/superset/config.py b/superset/config.py
index 37afdd5..988df25 100644
--- a/superset/config.py
+++ b/superset/config.py
@@ -285,7 +285,14 @@ BACKUP_COUNT = 30
 # Custom logger for auditing queries. This can be used to send ran queries to a
 # structured immutable store for auditing purposes. The function is called for
 # every query ran, in both SQL Lab and charts/dashboards.
-# def QUERY_LOGGER(database, query, schema=None, user=None, client=None):
+# def QUERY_LOGGER(
+#     database,
+#     query,
+#     schema=None,
+#     user=None,
+#     client=None,
+#     security_manager=None,
+# ):
 #     pass
 
 # Set this API key to enable Mapbox visualizations
diff --git a/superset/models/core.py b/superset/models/core.py
index 6f520aa..97dd54a 100644
--- a/superset/models/core.py
+++ b/superset/models/core.py
@@ -813,7 +813,7 @@ class Database(Model, AuditMixinNullable, ImportMixin):
 
         def _log_query(sql):
             if log_query:
-                log_query(engine.url, sql, schema, username, __name__)
+                log_query(engine.url, sql, schema, username, __name__, security_manager)
 
         with closing(engine.raw_connection()) as conn:
             with closing(conn.cursor()) as cursor:
diff --git a/superset/sql_lab.py b/superset/sql_lab.py
index 0c76c7c..5b3f927 100644
--- a/superset/sql_lab.py
+++ b/superset/sql_lab.py
@@ -189,6 +189,7 @@ def execute_sql(
                 query.schema,
                 user_name,
                 __name__,
+                security_manager,
             )
         db_engine_spec.execute(cursor, query.executed_sql, async_=True)
         logging.info('Handling cursor')