mirror of https://github.com/apache/superset.git
Pass security manager to QUERY_LOGGER (#6548)
* Pass security manager to log_query * Fix lint
This commit is contained in:
parent
fe994900ec
commit
672c470e79
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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')
|
||||
|
|
Loading…
Reference in New Issue