web/auth: middleware respone with 404
continuous-integration/drone the build was successful Details

This commit is contained in:
Geno 2021-09-12 22:41:33 +02:00
parent ea2ffbc424
commit 9b2fe62df5
1 changed files with 7 additions and 1 deletions

View File

@ -39,7 +39,7 @@ func MiddlewarePermissionParam(ws *web.Service, obj HasPermission, param string)
}) })
c.Abort() c.Abort()
} }
_, err = obj.HasPermission(ws.DB, userID, objID) d, err := obj.HasPermission(ws.DB, userID, objID)
if err != nil { if err != nil {
c.JSON(http.StatusUnauthorized, web.HTTPError{ c.JSON(http.StatusUnauthorized, web.HTTPError{
Message: ErrAPINoPermission.Error(), Message: ErrAPINoPermission.Error(),
@ -47,5 +47,11 @@ func MiddlewarePermissionParam(ws *web.Service, obj HasPermission, param string)
}) })
c.Abort() c.Abort()
} }
if d == nil {
c.JSON(http.StatusNotFound, web.HTTPError{
Message: web.ErrAPINotFound.Error(),
})
c.Abort()
}
} }
} }