summaryrefslogtreecommitdiffstats
path: root/cmd/hook.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 /cmd/hook.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 'cmd/hook.go')
-rw-r--r--cmd/hook.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd/hook.go b/cmd/hook.go
index 1dd59e8192..05fa6e56c1 100644
--- a/cmd/hook.go
+++ b/cmd/hook.go
@@ -185,7 +185,7 @@ Gitea or set your environment appropriately.`, "")
reponame := os.Getenv(models.EnvRepoName)
userID, _ := strconv.ParseInt(os.Getenv(models.EnvPusherID), 10, 64)
prID, _ := strconv.ParseInt(os.Getenv(models.EnvPRID), 10, 64)
- isDeployKey, _ := strconv.ParseBool(os.Getenv(models.EnvIsDeployKey))
+ deployKeyID, _ := strconv.ParseInt(os.Getenv(models.EnvDeployKeyID), 10, 64)
hookOptions := private.HookOptions{
UserID: userID,
@@ -194,7 +194,7 @@ Gitea or set your environment appropriately.`, "")
GitQuarantinePath: os.Getenv(private.GitQuarantinePath),
GitPushOptions: pushOptions(),
PullRequestID: prID,
- IsDeployKey: isDeployKey,
+ DeployKeyID: deployKeyID,
}
scanner := bufio.NewScanner(os.Stdin)