Fixed logging the current user if forbidden
This commit is contained in:
parent
b4a943dba1
commit
83337a24ac
|
@ -45,7 +45,7 @@ func (c *WebHandler) CreateWeb(ctx echo.Context) error {
|
|||
|
||||
// Check rights
|
||||
if !currentStruct.CanCreate(currentAuth) {
|
||||
getLogger(ctx).Noticef("Tried to create while not having the rights for it", currentAuth)
|
||||
getLogger(ctx).Noticef("Tried to create while not having the rights for it (User: %v)", currentAuth)
|
||||
return echo.NewHTTPError(http.StatusForbidden)
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ package handler
|
|||
import (
|
||||
"code.vikunja.io/web"
|
||||
"github.com/labstack/echo"
|
||||
"github.com/op/go-logging"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
|
@ -44,7 +43,7 @@ func (c *WebHandler) DeleteWeb(ctx echo.Context) error {
|
|||
return echo.NewHTTPError(http.StatusInternalServerError)
|
||||
}
|
||||
if !currentStruct.CanDelete(currentAuth) {
|
||||
getLogger(ctx).Noticef("Tried to delete while not having the rights for it", currentAuth)
|
||||
getLogger(ctx).Noticef("Tried to delete while not having the rights for it (User: %v)", currentAuth)
|
||||
return echo.NewHTTPError(http.StatusForbidden)
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ package handler
|
|||
import (
|
||||
"code.vikunja.io/web"
|
||||
"github.com/labstack/echo"
|
||||
"github.com/op/go-logging"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
|
@ -46,7 +45,7 @@ func (c *WebHandler) ReadOneWeb(ctx echo.Context) error {
|
|||
return echo.NewHTTPError(http.StatusInternalServerError, "Could not determine the current user.")
|
||||
}
|
||||
if !currentStruct.CanRead(currentAuth) {
|
||||
getLogger(ctx).Noticef("Tried to read one while not having the rights for it", currentAuth)
|
||||
getLogger(ctx).Noticef("Tried to read one while not having the rights for it (User: %v)", currentAuth)
|
||||
return echo.NewHTTPError(http.StatusForbidden, "You don't have the right to see this")
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ package handler
|
|||
import (
|
||||
"code.vikunja.io/web"
|
||||
"github.com/labstack/echo"
|
||||
"github.com/op/go-logging"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
|
@ -45,7 +44,7 @@ func (c *WebHandler) UpdateWeb(ctx echo.Context) error {
|
|||
return echo.NewHTTPError(http.StatusInternalServerError, "Could not determine the current user.")
|
||||
}
|
||||
if !currentStruct.CanUpdate(currentAuth) {
|
||||
getLogger(ctx).Noticef("Tried to update while not having the rights for it", currentAuth)
|
||||
getLogger(ctx).Noticef("Tried to update while not having the rights for it (User: %v)", currentAuth)
|
||||
return echo.NewHTTPError(http.StatusForbidden)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue