diff --git a/src/xiana/db.clj b/src/xiana/db.clj index eb27a095..2d9880ac 100644 --- a/src/xiana/db.clj +++ b/src/xiana/db.clj @@ -191,7 +191,8 @@ driver, if succeeds associate its results into state response data. Remember the entry query must be a sql-map, e.g: {:select [:*] :from [:users]}." - {:leave + {:name ::db-access + :leave (fn [{query-or-fn :query db-queries :db-queries :as state}] diff --git a/src/xiana/interceptor.clj b/src/xiana/interceptor.clj index 54b6abd5..02ae3402 100644 --- a/src/xiana/interceptor.clj +++ b/src/xiana/interceptor.clj @@ -15,7 +15,8 @@ "Log interceptor. Enter: Print 'Enter:' followed by the complete state map. Leave: Print 'Leave:' followed by the complete state map." - {:enter (fn [state] (pprint ["Enter: " state]) state) + {:name ::log + :enter (fn [state] (pprint ["Enter: " state]) state) :leave (fn [state] (pprint ["Leave: " state]) state)}) (def side-effect @@ -33,7 +34,8 @@ "View interceptor. Enter: nil. Leave: apply `:view` state key to state if it exists and `:response` is absent." - {:leave + {:name ::view + :leave (fn [{:keys [view response] :as state}] (if (and (not (:body response)) view) (view state) diff --git a/src/xiana/interceptor/queue.clj b/src/xiana/interceptor/queue.clj index 95e18b9c..908bf592 100644 --- a/src/xiana/interceptor/queue.clj +++ b/src/xiana/interceptor/queue.clj @@ -39,12 +39,6 @@ direction-enter? (= :enter direction) exception (:error state)] - (log/debug (format "%s | %s | err?: %s | exception %s" - direction - (-> interceptors first :name) - direction-error? - exception)) - (cond ;; just got an exception, executing all remaining interceptors backwards (and exception (not direction-error?)) @@ -67,6 +61,11 @@ next-interceptors (if (and (:error state) (= :leave direction)) interceptors (rest interceptors))] + (log/debug (format "%s | %s | err?: %s | exception %s" + direction + (-> interceptors first :name) + direction-error? + exception)) (recur state next-interceptors (when direction-enter? (conj backwards (first interceptors))) diff --git a/src/xiana/rbac.clj b/src/xiana/rbac.clj index f13cd269..e1df4e49 100644 --- a/src/xiana/rbac.clj +++ b/src/xiana/rbac.clj @@ -29,7 +29,8 @@ If it's not restricted do nothing, if the given user has no rights, it throws ex-info with data {:status 403 :body \"Forbidden\"}. On leave executes restriction function if any." - {:enter (fn [state] + {:name ::rbac + :enter (fn [state] (let [operation-restricted (get-in state [:request-data :permission]) permits (and operation-restricted (permissions state))] (cond