瀏覽代碼

HUE-7955 [importer] Move auditing code to main submit API

Romain Rigaux 7 年之前
父節點
當前提交
75941a8
共有 2 個文件被更改,包括 11 次插入6 次删除
  1. 11 0
      desktop/libs/indexer/src/indexer/api3.py
  2. 0 6
      desktop/libs/notebook/src/notebook/api.py

+ 11 - 0
desktop/libs/indexer/src/indexer/api3.py

@@ -221,6 +221,17 @@ def importer_submit(request):
   else:
     job_handle = _create_table(request, source, destination, start_time)
 
+  request.audit = {
+    'operation': 'EXPORT',
+    'operationText': 'User %(username)s exported %(inputFormat)s to %(ouputFormat)s: %(name)s' % {
+        'username': request.user.username,
+        'inputFormat': source['inputFormat'],
+        'ouputFormat': destination['ouputFormat'],
+        'name': destination['name'],
+    },
+    'allowed': True
+  }
+
   return JsonResponse(job_handle)
 
 

+ 0 - 6
desktop/libs/notebook/src/notebook/api.py

@@ -751,12 +751,6 @@ def export_result(request):
     if response.get('status') != 0:
       response['message'] =  _('Exporting result failed.')
 
-    request.audit = {
-      'operation': 'EXPORT',
-      'operationText': 'User %s exported to Search index: %s' % (request.user.username, destination),
-      'allowed': True
-    }
-
   return JsonResponse(response)