summaryrefslogtreecommitdiffstats
path: root/routers/private/serv.go
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2022-03-22 17:29:07 +0800
committerGitHub <noreply@github.com>2022-03-22 17:29:07 +0800
commit2b55422cd71b0b325f054646de5cebf39b72b502 (patch)
tree27e71f4e6e27fd5bbb2c13a27e572ef0b41a1e6d /routers/private/serv.go
parent80fd25524e13dedbdc3527b32d008de152213a89 (diff)
downloadgitea-2b55422cd71b0b325f054646de5cebf39b72b502.tar.gz
gitea-2b55422cd71b0b325f054646de5cebf39b72b502.zip
Fix the bug: deploy key with write access can not push (#19010)
Use DeployKeyID to replace the IsDeployKey, then CanWriteCode uses the DeployKeyID to check the write permission.
Diffstat (limited to 'routers/private/serv.go')
-rw-r--r--routers/private/serv.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/routers/private/serv.go b/routers/private/serv.go
index 65989d868b..b0451df5d8 100644
--- a/routers/private/serv.go
+++ b/routers/private/serv.go
@@ -229,8 +229,6 @@ func ServCommand(ctx *context.PrivateContext) {
var deployKey *asymkey_model.DeployKey
var user *user_model.User
if key.Type == asymkey_model.KeyTypeDeploy {
- results.IsDeployKey = true
-
var err error
deployKey, err = asymkey_model.GetDeployKeyByRepo(key.ID, repo.ID)
if err != nil {
@@ -248,6 +246,7 @@ func ServCommand(ctx *context.PrivateContext) {
})
return
}
+ results.DeployKeyID = deployKey.ID
results.KeyName = deployKey.Name
// FIXME: Deploy keys aren't really the owner of the repo pushing changes
@@ -410,9 +409,9 @@ func ServCommand(ctx *context.PrivateContext) {
return
}
}
- log.Debug("Serv Results:\nIsWiki: %t\nIsDeployKey: %t\nKeyID: %d\tKeyName: %s\nUserName: %s\nUserID: %d\nOwnerName: %s\nRepoName: %s\nRepoID: %d",
+ log.Debug("Serv Results:\nIsWiki: %t\nDeployKeyID: %d\nKeyID: %d\tKeyName: %s\nUserName: %s\nUserID: %d\nOwnerName: %s\nRepoName: %s\nRepoID: %d",
results.IsWiki,
- results.IsDeployKey,
+ results.DeployKeyID,
results.KeyID,
results.KeyName,
results.UserName,