A continuation of HomeBox the inventory and organization system built for the Home User
fix: block self-delete on demo site (#57)
Haydenae73b194c47f
diff --git a/backend/app/api/v1/v1_ctrl_user.go b/backend/app/api/v1/v1_ctrl_user.goindex 10fdbb17..dc2779a3 100644--- a/backend/app/api/v1/v1_ctrl_user.go+++ b/backend/app/api/v1/v1_ctrl_user.go@@ -110,6 +110,11 @@ func (ctrl *V1Controller) HandleUserUpdatePassword() http.HandlerFunc {// @Security Bearerfunc (ctrl *V1Controller) HandleUserSelfDelete() http.HandlerFunc {return func(w http.ResponseWriter, r *http.Request) {+ if ctrl.isDemo {+ server.RespondError(w, http.StatusForbidden, nil)+ return+ }+actor := services.UseUserCtx(r.Context())if err := ctrl.svc.User.DeleteSelf(r.Context(), actor.ID); err != nil {server.RespondError(w, http.StatusInternalServerError, err)