grim/hgkeeper

76eb73c033fc
Wire up permissions still need to handle readonly
package commands
import (
"path/filepath"
"golang.org/x/crypto/ssh"
"bitbucket.org/rw_grim/hgkeeper/access"
"bitbucket.org/rw_grim/hgkeeper/hg"
)
type Serve struct {
repoPath string
repoName string
}
func NewServe(reposPath, repoName string) *Serve {
return &Serve{
repoPath: filepath.Join(reposPath, repoName),
repoName: repoName,
}
}
func (s *Serve) Run(conn ssh.Channel, serverConn *ssh.ServerConn, req *ssh.Request) error {
return run(hg.Serve(s.repoPath), conn, serverConn, req)
}
func (s *Serve) CheckAccess(access *access.Access, username string) bool {
return access.Global.CanRead(username)
}
func (s *Serve) String() string {
return "hg serve"
}