aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/user/app.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/v1/user/app.go')
-rw-r--r--routers/api/v1/user/app.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/routers/api/v1/user/app.go b/routers/api/v1/user/app.go
index 94cfab45bd..165b8f005e 100644
--- a/routers/api/v1/user/app.go
+++ b/routers/api/v1/user/app.go
@@ -45,7 +45,7 @@ func ListAccessTokens(ctx *context.APIContext) {
// "200":
// "$ref": "#/responses/AccessTokenList"
- opts := models.ListAccessTokensOptions{UserID: ctx.User.ID, ListOptions: utils.GetListOptions(ctx)}
+ opts := models.ListAccessTokensOptions{UserID: ctx.Doer.ID, ListOptions: utils.GetListOptions(ctx)}
count, err := models.CountAccessTokens(opts)
if err != nil {
@@ -99,7 +99,7 @@ func CreateAccessToken(ctx *context.APIContext) {
form := web.GetForm(ctx).(*api.CreateAccessTokenOption)
t := &models.AccessToken{
- UID: ctx.User.ID,
+ UID: ctx.Doer.ID,
Name: form.Name,
}
@@ -157,7 +157,7 @@ func DeleteAccessToken(ctx *context.APIContext) {
if tokenID == 0 {
tokens, err := models.ListAccessTokens(models.ListAccessTokensOptions{
Name: token,
- UserID: ctx.User.ID,
+ UserID: ctx.Doer.ID,
})
if err != nil {
ctx.Error(http.StatusInternalServerError, "ListAccessTokens", err)
@@ -180,7 +180,7 @@ func DeleteAccessToken(ctx *context.APIContext) {
return
}
- if err := models.DeleteAccessTokenByID(tokenID, ctx.User.ID); err != nil {
+ if err := models.DeleteAccessTokenByID(tokenID, ctx.Doer.ID); err != nil {
if models.IsErrAccessTokenNotExist(err) {
ctx.NotFound()
} else {
@@ -215,7 +215,7 @@ func CreateOauth2Application(ctx *context.APIContext) {
app, err := auth.CreateOAuth2Application(auth.CreateOAuth2ApplicationOptions{
Name: data.Name,
- UserID: ctx.User.ID,
+ UserID: ctx.Doer.ID,
RedirectURIs: data.RedirectURIs,
})
if err != nil {
@@ -252,7 +252,7 @@ func ListOauth2Applications(ctx *context.APIContext) {
// "200":
// "$ref": "#/responses/OAuth2ApplicationList"
- apps, total, err := auth.ListOAuth2Applications(ctx.User.ID, utils.GetListOptions(ctx))
+ apps, total, err := auth.ListOAuth2Applications(ctx.Doer.ID, utils.GetListOptions(ctx))
if err != nil {
ctx.Error(http.StatusInternalServerError, "ListOAuth2Applications", err)
return
@@ -288,7 +288,7 @@ func DeleteOauth2Application(ctx *context.APIContext) {
// "404":
// "$ref": "#/responses/notFound"
appID := ctx.ParamsInt64(":id")
- if err := auth.DeleteOAuth2Application(appID, ctx.User.ID); err != nil {
+ if err := auth.DeleteOAuth2Application(appID, ctx.Doer.ID); err != nil {
if auth.IsErrOAuthApplicationNotFound(err) {
ctx.NotFound()
} else {
@@ -365,7 +365,7 @@ func UpdateOauth2Application(ctx *context.APIContext) {
app, err := auth.UpdateOAuth2Application(auth.UpdateOAuth2ApplicationOptions{
Name: data.Name,
- UserID: ctx.User.ID,
+ UserID: ctx.Doer.ID,
ID: appID,
RedirectURIs: data.RedirectURIs,
})