Let rights methods return errors (#64)
This commit is contained in:
6
vendor/code.vikunja.io/web/handler/delete.go
generated
vendored
6
vendor/code.vikunja.io/web/handler/delete.go
generated
vendored
@ -40,7 +40,11 @@ func (c *WebHandler) DeleteWeb(ctx echo.Context) error {
|
||||
if err != nil {
|
||||
return echo.NewHTTPError(http.StatusInternalServerError)
|
||||
}
|
||||
if !currentStruct.CanDelete(currentAuth) {
|
||||
canDelete, err := currentStruct.CanDelete(currentAuth)
|
||||
if err != nil {
|
||||
return HandleHTTPError(err, ctx)
|
||||
}
|
||||
if canDelete {
|
||||
config.LoggingProvider.Noticef("Tried to create while not having the rights for it (User: %v)", currentAuth)
|
||||
return echo.NewHTTPError(http.StatusForbidden)
|
||||
}
|
||||
|
Reference in New Issue
Block a user