Should fix most of the authentication issues
This commit is contained in:
@@ -5,10 +5,12 @@
|
||||
[auto-ap.time :as atime]
|
||||
[buddy.auth :refer [throw-unauthorized]]
|
||||
[datomic.api :as dc]
|
||||
[iol-ion.query :refer [entid]]
|
||||
[clojure.walk :as walk]
|
||||
[com.walmartlabs.lacinia.util :refer [attach-resolvers]]
|
||||
[clojure.tools.logging :as log]
|
||||
[com.brunobonacci.mulog :as mu]))
|
||||
[com.brunobonacci.mulog :as mu]
|
||||
[clojure.set :as set]))
|
||||
|
||||
|
||||
(defn snake->kebab [s]
|
||||
@@ -163,6 +165,29 @@
|
||||
resolver-key (trace-query resolver-key resolver-fn))
|
||||
)
|
||||
{}
|
||||
m))
|
||||
m)))
|
||||
|
||||
)
|
||||
(defn extract-client-ids [user-clients & possible-clients]
|
||||
(let [coerce-client-ids (fn coerce-client-ids [x]
|
||||
(cond (and (map? x)
|
||||
(:db/id x))
|
||||
[(:db/id x)]
|
||||
|
||||
(nat-int? x)
|
||||
[x]
|
||||
|
||||
(and (vector? x)
|
||||
(= :client/code (first x)))
|
||||
[(entid (dc/db conn) x)]
|
||||
|
||||
|
||||
(sequential? x)
|
||||
(map x coerce-client-ids)
|
||||
|
||||
:else
|
||||
[]))
|
||||
user-client-ids (set (mapcat coerce-client-ids user-clients))
|
||||
extra-client-ids (set (mapcat coerce-client-ids possible-clients))]
|
||||
(if (seq extra-client-ids)
|
||||
(set/intersection user-client-ids extra-client-ids)
|
||||
user-client-ids)))
|
||||
|
||||
Reference in New Issue
Block a user