diff options
author | Colin Okay <okay@toyful.space> | 2022-02-23 17:12:01 -0600 |
---|---|---|
committer | Colin Okay <okay@toyful.space> | 2022-02-23 17:12:01 -0600 |
commit | 3f6c87e6ebce5081d9f830f5d302009edc2029f1 (patch) | |
tree | 2eea053a9e0d93293e52e7ab542b59a8d2bbc505 /src/main.lisp | |
parent | 88ba89df590cafd5383b5ab89093baf52518bbc2 (diff) |
added lockedp slot and endpoint for setting it.
Diffstat (limited to 'src/main.lisp')
-rw-r--r-- | src/main.lisp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/main.lisp b/src/main.lisp index c7e63f6..1d65531 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -64,7 +64,11 @@ (adminp :accessor adminp :initform nil - :documentation "indicates whether or not this contributor has admin privileges.")) + :documentation "indicates whether or not this contributor has admin privileges.") + (lockedp + :accessor contributor-lockedp + :initform nil + :documentation "indicates that this contributor is currently banned from editing.")) (:metaclass db:persistent-class)) (defun can-invite-p (contributor) @@ -278,6 +282,11 @@ ;;; DATABASE TRANSACTIONS +(defun set-contributor-locked (contributor value) + "Lock / unlock a contributor account" + (db:with-transaction () + (setf (contributor-lockedp contributor) value))) + (defun make-new-invite (&optional contributor) "Make and return a new invite object. " (db:with-transaction () @@ -443,6 +452,11 @@ ;;; ENDPOINT DEFINITIONS +(defendpoint* :put "/contributor/:handle a-user-handle:/locked" ((value a-boolean)) + (:auth 'admin-only) + (set-contributor-locked contributor value) + "true") + (defendpoint* :post "/invite/redeem/:code an-invite-code:" () () "Redeem an [invite code](#invite-code) and create a new [contributor](#new-contributor-post-body)" (with-plist (password1 password2 handle) (lzb:request-body) |