Skip to content

Commit

Permalink
fixing crossdata2 driver with impersonation flag (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
screspo-stratio authored May 9, 2019
1 parent 25fc858 commit b50e0fd
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/metabase/driver/crossdata2.clj
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,6 @@
"Process and run a native (raw SQL) QUERY."
[driver {:keys [database settings ], query :native, {sql :query, params :params} :native, :as outer-query}]

(def query_with_nominal_user
(assoc query :query (str "execute as " (get @api/*current-user* :first_name) " " (get query :query))))
(println "query modificada con usuario: " query_with_nominal_user)


(let [sql (str
(if (seq params)
(unprepare/unprepare (cons sql params))
Expand All @@ -120,7 +115,7 @@
(qprocessor/do-with-try-catch
(fn []
(if (true? (get-in database [:details :impersonate]))
(qprocessor/do-in-transaction db-connection (partial qprocessor/run-query-with-out-remark query_with_nominal_user))
(qprocessor/do-in-transaction db-connection (partial qprocessor/run-query-with-out-remark (assoc query :query (str "execute as " (get @api/*current-user* :first_name) " " (get query :query)))))
(qprocessor/do-in-transaction db-connection (partial qprocessor/run-query-with-out-remark query)))))))))

(defn apply-order-by
Expand Down

0 comments on commit b50e0fd

Please sign in to comment.