1
0

Implemented CanUpdate method

This commit is contained in:
konrad
2018-07-12 23:07:03 +02:00
committed by kolaente
parent e3b996c383
commit 6fd2a97574
10 changed files with 54 additions and 70 deletions

View File

@ -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(&currentUser, id) {
return echo.NewHTTPError(http.StatusForbidden)
}
// Do the update
err = c.CObject.Update(id, &currentUser)
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.")