mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-07 07:47:02 +02:00
Fix permissions for Token DELETE endpoint to match GET and POST (#27610)
Fixes #27598 In #27080, the logic for the tokens endpoints were updated to allow admins to create and view tokens in other accounts. However, the same functionality was not added to the DELETE endpoint. This PR makes the DELETE endpoint function the same as the other token endpoints and adds unit tests
This commit is contained in:
1 parent
c6c829fe3f
commit
ae419fa494
2 files changed
+30
-3
No files matched your search
@@ -193,7 +193,7 @@ func DeleteAccessToken(ctx *context.APIContext) {
|
||||
return
|
||||
}
|
||||
|
||||
if err := auth_model.DeleteAccessTokenByID(ctx, tokenID, ctx.Doer.ID); err != nil {
|
||||
if err := auth_model.DeleteAccessTokenByID(ctx, tokenID, ctx.ContextUser.ID); err != nil {
|
||||
if auth_model.IsErrAccessTokenNotExist(err) {
|
||||
ctx.NotFound()
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user