diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2022-03-22 17:29:07 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-22 17:29:07 +0800 |
commit | 2b55422cd71b0b325f054646de5cebf39b72b502 (patch) | |
tree | 27e71f4e6e27fd5bbb2c13a27e572ef0b41a1e6d /models/asymkey | |
parent | 80fd25524e13dedbdc3527b32d008de152213a89 (diff) | |
download | gitea-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 'models/asymkey')
-rw-r--r-- | models/asymkey/ssh_key_deploy.go | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/models/asymkey/ssh_key_deploy.go b/models/asymkey/ssh_key_deploy.go index fc6324792a..fe2ade43ae 100644 --- a/models/asymkey/ssh_key_deploy.go +++ b/models/asymkey/ssh_key_deploy.go @@ -58,7 +58,7 @@ func (key *DeployKey) GetContent() error { return nil } -// IsReadOnly checks if the key can only be used for read operations +// IsReadOnly checks if the key can only be used for read operations, used by template func (key *DeployKey) IsReadOnly() bool { return key.Mode == perm.AccessModeRead } @@ -203,12 +203,6 @@ func UpdateDeployKeyCols(key *DeployKey, cols ...string) error { return err } -// UpdateDeployKey updates deploy key information. -func UpdateDeployKey(key *DeployKey) error { - _, err := db.GetEngine(db.DefaultContext).ID(key.ID).AllCols().Update(key) - return err -} - // ListDeployKeysOptions are options for ListDeployKeys type ListDeployKeysOptions struct { db.ListOptions |