aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/user
diff options
context:
space:
mode:
authorJakobDev <jakobdev@gmx.de>2023-10-14 10:37:24 +0200
committerGitHub <noreply@github.com>2023-10-14 08:37:24 +0000
commit76a85a4ce90fead1eb2b743a42b41617b4592889 (patch)
treeef172bbbc48c24e0d95cd5c689426bad16205a69 /routers/api/v1/user
parentae419fa49403537725c806a5f3f1e5b274f52eb7 (diff)
downloadgitea-76a85a4ce90fead1eb2b743a42b41617b4592889.tar.gz
gitea-76a85a4ce90fead1eb2b743a42b41617b4592889.zip
Final round of `db.DefaultContext` refactor (#27587)
Last part of #27065
Diffstat (limited to 'routers/api/v1/user')
-rw-r--r--routers/api/v1/user/app.go10
-rw-r--r--routers/api/v1/user/gpg_key.go4
2 files changed, 7 insertions, 7 deletions
diff --git a/routers/api/v1/user/app.go b/routers/api/v1/user/app.go
index cdec69be57..fef0240b0f 100644
--- a/routers/api/v1/user/app.go
+++ b/routers/api/v1/user/app.go
@@ -236,7 +236,7 @@ func CreateOauth2Application(ctx *context.APIContext) {
ctx.Error(http.StatusBadRequest, "", "error creating oauth2 application")
return
}
- secret, err := app.GenerateClientSecret()
+ secret, err := app.GenerateClientSecret(ctx)
if err != nil {
ctx.Error(http.StatusBadRequest, "", "error creating application secret")
return
@@ -266,7 +266,7 @@ func ListOauth2Applications(ctx *context.APIContext) {
// "200":
// "$ref": "#/responses/OAuth2ApplicationList"
- apps, total, err := auth_model.ListOAuth2Applications(ctx.Doer.ID, utils.GetListOptions(ctx))
+ apps, total, err := auth_model.ListOAuth2Applications(ctx, ctx.Doer.ID, utils.GetListOptions(ctx))
if err != nil {
ctx.Error(http.StatusInternalServerError, "ListOAuth2Applications", err)
return
@@ -302,7 +302,7 @@ func DeleteOauth2Application(ctx *context.APIContext) {
// "404":
// "$ref": "#/responses/notFound"
appID := ctx.ParamsInt64(":id")
- if err := auth_model.DeleteOAuth2Application(appID, ctx.Doer.ID); err != nil {
+ if err := auth_model.DeleteOAuth2Application(ctx, appID, ctx.Doer.ID); err != nil {
if auth_model.IsErrOAuthApplicationNotFound(err) {
ctx.NotFound()
} else {
@@ -377,7 +377,7 @@ func UpdateOauth2Application(ctx *context.APIContext) {
data := web.GetForm(ctx).(*api.CreateOAuth2ApplicationOptions)
- app, err := auth_model.UpdateOAuth2Application(auth_model.UpdateOAuth2ApplicationOptions{
+ app, err := auth_model.UpdateOAuth2Application(ctx, auth_model.UpdateOAuth2ApplicationOptions{
Name: data.Name,
UserID: ctx.Doer.ID,
ID: appID,
@@ -392,7 +392,7 @@ func UpdateOauth2Application(ctx *context.APIContext) {
}
return
}
- app.ClientSecret, err = app.GenerateClientSecret()
+ app.ClientSecret, err = app.GenerateClientSecret(ctx)
if err != nil {
ctx.Error(http.StatusBadRequest, "", "error updating application secret")
return
diff --git a/routers/api/v1/user/gpg_key.go b/routers/api/v1/user/gpg_key.go
index 8578e09054..404b1d221e 100644
--- a/routers/api/v1/user/gpg_key.go
+++ b/routers/api/v1/user/gpg_key.go
@@ -185,9 +185,9 @@ func VerifyUserGPGKey(ctx *context.APIContext) {
return
}
- _, err := asymkey_model.VerifyGPGKey(ctx.Doer.ID, form.KeyID, token, form.Signature)
+ _, err := asymkey_model.VerifyGPGKey(ctx, ctx.Doer.ID, form.KeyID, token, form.Signature)
if err != nil && asymkey_model.IsErrGPGInvalidTokenSignature(err) {
- _, err = asymkey_model.VerifyGPGKey(ctx.Doer.ID, form.KeyID, lastToken, form.Signature)
+ _, err = asymkey_model.VerifyGPGKey(ctx, ctx.Doer.ID, form.KeyID, lastToken, form.Signature)
}
if err != nil {