1
0
Fork 0
forked from forgejo/forgejo

More refactoring of db.DefaultContext (#27083)

Next step of #27065
This commit is contained in:
JakobDev 2023-09-15 08:13:19 +02:00 committed by GitHub
parent f8a1094406
commit c548dde205
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
83 changed files with 336 additions and 320 deletions

View file

@ -71,7 +71,7 @@ func (b *Basic) Verify(req *http.Request, w http.ResponseWriter, store DataStore
}
// check oauth2 token
uid := CheckOAuthAccessToken(authToken)
uid := CheckOAuthAccessToken(req.Context(), authToken)
if uid != 0 {
log.Trace("Basic Authorization: Valid OAuthAccessToken for user[%d]", uid)
@ -86,7 +86,7 @@ func (b *Basic) Verify(req *http.Request, w http.ResponseWriter, store DataStore
}
// check personal access token
token, err := auth_model.GetAccessTokenBySHA(authToken)
token, err := auth_model.GetAccessTokenBySHA(req.Context(), authToken)
if err == nil {
log.Trace("Basic Authorization: Valid AccessToken for user[%d]", uid)
u, err := user_model.GetUserByID(req.Context(), token.UID)
@ -96,7 +96,7 @@ func (b *Basic) Verify(req *http.Request, w http.ResponseWriter, store DataStore
}
token.UpdatedUnix = timeutil.TimeStampNow()
if err = auth_model.UpdateAccessToken(token); err != nil {
if err = auth_model.UpdateAccessToken(req.Context(), token); err != nil {
log.Error("UpdateAccessToken: %v", err)
}