Improved item deletion rights check
This commit is contained in:
parent
1bb7187285
commit
1b3b2ccb59
3 changed files with 20 additions and 1 deletions
|
|
@ -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."})
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue