1
0

Added logging

This commit is contained in:
kolaente
2018-09-19 08:35:53 +02:00
parent 091711f4c5
commit e93cba7108
24 changed files with 1596 additions and 10 deletions

View File

@ -24,12 +24,15 @@ func (c *WebHandler) UpdateWeb(ctx echo.Context) error {
return echo.NewHTTPError(http.StatusInternalServerError, "Could not determine the current user.")
}
if !c.CObject.CanUpdate(&currentUser) {
models.Log.Noticef("%s [ID: %d] tried to update while not having the rights for it", currentUser.Username, currentUser.ID)
return echo.NewHTTPError(http.StatusForbidden)
}
// Do the update
err = c.CObject.Update()
if err != nil {
models.Log.Error(err.Error())
if models.IsErrNeedToBeListAdmin(err) {
return echo.NewHTTPError(http.StatusForbidden, "You need to be list admin to do that.")
}