Improved item deletion rights check

This commit is contained in:
konrad 2018-06-12 18:49:56 +02:00 committed by kolaente
parent 1bb7187285
commit 1b3b2ccb59
Signed by untrusted user who does not match committer: konrad
GPG key ID: F40E70337AB24C9B
3 changed files with 20 additions and 1 deletions

View file

@ -28,6 +28,10 @@ func DeleteListItemByIDtemByID(c echo.Context) error {
return c.JSON(http.StatusNotFound, models.Message{"List item does not exist."})
}
if models.IsErrNeedToBeItemOwner(err) {
return c.JSON(http.StatusForbidden, models.Message{"You need to own the list item in order to be able to delete it."})
}
return c.JSON(http.StatusInternalServerError, models.Message{"An error occured."})
}