Let rights methods return errors (#64)
This commit is contained in:
6
vendor/code.vikunja.io/web/handler/read_one.go
generated
vendored
6
vendor/code.vikunja.io/web/handler/read_one.go
generated
vendored
@ -42,7 +42,11 @@ func (c *WebHandler) ReadOneWeb(ctx echo.Context) error {
|
||||
if err != nil {
|
||||
return echo.NewHTTPError(http.StatusInternalServerError, "Could not determine the current user.")
|
||||
}
|
||||
if !currentStruct.CanRead(currentAuth) {
|
||||
canRead, err := currentStruct.CanRead(currentAuth)
|
||||
if err != nil {
|
||||
return HandleHTTPError(err, ctx)
|
||||
}
|
||||
if canRead {
|
||||
config.LoggingProvider.Noticef("Tried to create while not having the rights for it (User: %v)", currentAuth)
|
||||
return echo.NewHTTPError(http.StatusForbidden, "You don't have the right to see this")
|
||||
}
|
||||
|
Reference in New Issue
Block a user