From 3f6c87e6ebce5081d9f830f5d302009edc2029f1 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Wed, 23 Feb 2022 17:12:01 -0600 Subject: added lockedp slot and endpoint for setting it. --- src/main.lisp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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) -- cgit v1.2.3