|
|
|
@ -14,7 +14,6 @@
|
|
|
|
|
(:export #:csrf-token |
|
|
|
|
#:get-user-roles |
|
|
|
|
#:get-current-user |
|
|
|
|
#:get-user-id |
|
|
|
|
#:flash-gethash |
|
|
|
|
#:auth-user-data)) |
|
|
|
|
|
|
|
|
@ -45,17 +44,11 @@
|
|
|
|
|
(mito:find-dao |
|
|
|
|
'user::user :username username)))) |
|
|
|
|
(and user |
|
|
|
|
(= (user::is-administrator-p user) app-constants:+true+) |
|
|
|
|
(= (user::is-administrator-p user) +true+) |
|
|
|
|
'(:administrator))))) |
|
|
|
|
:session ningle:*session* |
|
|
|
|
:denied (constantly '(400 (:content-type "text/plain") ("Authentication denied")))) |
|
|
|
|
|
|
|
|
|
;; TODO: MOVE GET-USER OUT OF AUTH PACKAGE (NOT APPLICABLE HERE)) |
|
|
|
|
(defun get-user (username) |
|
|
|
|
"Returns a `USER' profile from the database." |
|
|
|
|
(with-connection (db) |
|
|
|
|
(mito:find-dao 'user :username username))) |
|
|
|
|
|
|
|
|
|
(defun get-current-user() |
|
|
|
|
"Returns the currently logged in user from the browser session." |
|
|
|
|
(with-connection (db) |
|
|
|
@ -67,13 +60,6 @@
|
|
|
|
|
:roles ,(auth:get-user-roles) |
|
|
|
|
:user ,(auth:get-current-user))) |
|
|
|
|
|
|
|
|
|
;; TODO: MOVE GET-USER-ID OUT OF AUTH PACKAGE (NOT APPLICABLE HERE)) |
|
|
|
|
(defun get-user-id (username) |
|
|
|
|
"Returns the Id. number of the specified `USERNAME' in the database." |
|
|
|
|
(with-connection (db) |
|
|
|
|
(mito:object-id |
|
|
|
|
(mito:find-dao 'user :username username)))) |
|
|
|
|
|
|
|
|
|
(defun get-user-roles() |
|
|
|
|
"Returns a list of roles the current user has assigned to them. |
|
|
|
|
This is mostly to check if the user is logged-in or has administration |
|
|
|
|