Skip to content

A continuation of HomeBox the inventory and organization system built for the Home User

Update backend/app/api/handlers/v1/v1_ctrl_actions.go

Philc31410727b3f
diff --git a/backend/app/api/handlers/v1/v1_ctrl_actions.go b/backend/app/api/handlers/v1/v1_ctrl_actions.go
index c73398c8..c1633893 100644
--- a/backend/app/api/handlers/v1/v1_ctrl_actions.go
+++ b/backend/app/api/handlers/v1/v1_ctrl_actions.go
@@ -105,5 +105,11 @@ func (ctrl *V1Controller) HandleCreateMissingThumbnails() errchain.HandlerFunc {
// @Router /v1/actions/wipe-inventory [Post]
// @Security Bearer
func (ctrl *V1Controller) HandleWipeInventory() errchain.HandlerFunc {
- return actionHandlerFactory("wipe inventory", ctrl.repo.Items.WipeInventory)
+ return func(w http.ResponseWriter, r *http.Request) error {
+ if ctrl.isDemo {
+ return validate.NewRequestError(errors.New("wipe inventory is not allowed in demo mode"), http.StatusForbidden)
+ }
+
+ return actionHandlerFactory("wipe inventory", ctrl.repo.Items.WipeInventory)(w, r)
+ }
}