forked from mirrors/homebox
fix: block self-delete on demo site (#57)
This commit is contained in:
parent
30014a77ca
commit
ae73b194c4
1 changed files with 5 additions and 0 deletions
|
@ -110,6 +110,11 @@ func (ctrl *V1Controller) HandleUserUpdatePassword() http.HandlerFunc {
|
|||
// @Security Bearer
|
||||
func (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)
|
||||
|
|
Loading…
Reference in a new issue