make admin user depend on zeusid and username
This commit is contained in:
parent
7ccb7b9150
commit
3e7b8a8b94
1 changed files with 4 additions and 3 deletions
|
@ -5,14 +5,15 @@
|
||||||
[cat.moauth :as mo]
|
[cat.moauth :as mo]
|
||||||
[cat.db.core :refer [*db*] :as db]))
|
[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]
|
(defn set-user! [user session redirect-url]
|
||||||
(log/info "Set user in session: " user)
|
(log/info "Set user in session: " user)
|
||||||
(let [new-session (-> session
|
(let [new-session (-> session
|
||||||
(assoc :user user)
|
(assoc :user user)
|
||||||
(cond-> (contains? admins (:id user))
|
(cond-> (some (partial = (select-keys user [:zeusid :name])) admins)
|
||||||
(->
|
(->
|
||||||
(assoc-in [:user :admin] {:enabled false})
|
(assoc-in [:user :admin] {:enabled false})
|
||||||
(assoc :identity "foo"))))]
|
(assoc :identity "foo"))))]
|
||||||
|
|
Loading…
Reference in a new issue