make admin user depend on zeusid and username

This commit is contained in:
flynn 2019-02-16 00:49:06 +01:00
parent 7ccb7b9150
commit 3e7b8a8b94

View file

@ -5,14 +5,15 @@
[cat.moauth :as mo]
[cat.db.core :refer [*db*] :as db]))
(def admins #{10 ;flynn
})
; This list contains application admins, they can add non-zeus people and can add relations
; More functionality is planned
(def admins [{:name "flynn" :zeusid 117}])
(defn set-user! [user session redirect-url]
(log/info "Set user in session: " user)
(let [new-session (-> session
(assoc :user user)
(cond-> (contains? admins (:id user))
(cond-> (some (partial = (select-keys user [:zeusid :name])) admins)
(->
(assoc-in [:user :admin] {:enabled false})
(assoc :identity "foo"))))]