Implemented CanUpdate method
This commit is contained in:
@ -24,9 +24,12 @@ func (c *WebHandler) UpdateWeb(ctx echo.Context) error {
|
||||
if err != nil {
|
||||
return echo.NewHTTPError(http.StatusInternalServerError, "Could not determine the current user.")
|
||||
}
|
||||
if !c.CObject.CanUpdate(¤tUser, id) {
|
||||
return echo.NewHTTPError(http.StatusForbidden)
|
||||
}
|
||||
|
||||
// Do the update
|
||||
err = c.CObject.Update(id, ¤tUser)
|
||||
err = c.CObject.Update(id)
|
||||
if err != nil {
|
||||
if models.IsErrNeedToBeListAdmin(err) {
|
||||
return echo.NewHTTPError(http.StatusForbidden, "You need to be list admin to do that.")
|
||||
|
Reference in New Issue
Block a user