wocao
This commit is contained in:
@@ -1,14 +1,3 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
package state
|
||||
|
||||
import (
|
||||
@@ -22,12 +11,6 @@ import (
|
||||
"simplegit/common"
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
func (s *LocalState) AccessBySSHKey(ctx context.Context, key ssh.PublicKey, owner, name string, perm common.Perm) (bool, error) {
|
||||
r, err := s.findRepo(owner, name)
|
||||
if err != nil {
|
||||
@@ -51,7 +34,6 @@ func (s *LocalState) AccessBySSHKey(ctx context.Context, key ssh.PublicKey, owne
|
||||
sk.LastUsedAt = &now
|
||||
}
|
||||
|
||||
|
||||
if perm == common.PermRead && !r.IsPrivate {
|
||||
return true, nil
|
||||
}
|
||||
@@ -65,21 +47,6 @@ func (s *LocalState) AccessBySSHKey(ctx context.Context, key ssh.PublicKey, owne
|
||||
return true, nil
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
func (s *LocalState) KnownSSHKey(key ssh.PublicKey) (bool, error) {
|
||||
var sk SSHKey
|
||||
has, err := s.engine.Where("fingerprint = ?", fingerprint(key)).Get(&sk)
|
||||
@@ -90,8 +57,6 @@ func (s *LocalState) KnownSSHKey(key ssh.PublicKey) (bool, error) {
|
||||
return false, ErrDenied
|
||||
}
|
||||
|
||||
|
||||
|
||||
hasGrant, err := s.keyHasGrant(sk.ID)
|
||||
if err != nil {
|
||||
return false, err
|
||||
@@ -102,8 +67,6 @@ func (s *LocalState) KnownSSHKey(key ssh.PublicKey) (bool, error) {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
|
||||
|
||||
func (s *LocalState) keyHasGrant(credID int64) (bool, error) {
|
||||
count, err := s.engine.Where("cred_type = ? AND cred_id = ?", CredTypeSSH, credID).Count(&ACL{})
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user