aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.lisp16
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)