summaryrefslogtreecommitdiffstats
path: root/modules
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 /modules
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 'modules')
-rw-r--r--modules/private/hook.go2
-rw-r--r--modules/private/serv.go6
2 files changed, 4 insertions, 4 deletions
diff --git a/modules/private/hook.go b/modules/private/hook.go
index fd864b1e6b..559019344e 100644
--- a/modules/private/hook.go
+++ b/modules/private/hook.go
@@ -56,7 +56,7 @@ type HookOptions struct {
GitQuarantinePath string
GitPushOptions GitPushOptions
PullRequestID int64
- IsDeployKey bool
+ DeployKeyID int64 // if the pusher is a DeployKey, then UserID is the repo's org user.
IsWiki bool
}
diff --git a/modules/private/serv.go b/modules/private/serv.go
index e1204c23a7..2e1367e4c4 100644
--- a/modules/private/serv.go
+++ b/modules/private/serv.go
@@ -46,9 +46,9 @@ func ServNoCommand(ctx context.Context, keyID int64) (*asymkey_model.PublicKey,
// ServCommandResults are the results of a call to the private route serv
type ServCommandResults struct {
IsWiki bool
- IsDeployKey bool
- KeyID int64
- KeyName string
+ DeployKeyID int64
+ KeyID int64 // public key
+ KeyName string // this field is ambiguous, it can be the name of DeployKey, or the name of the PublicKey
UserName string
UserEmail string
UserID int64