grim/hgkeeper

Well everything kind of works, but hg init is throwing failures eventhough it's creating repos
package access
import (
"io"
"github.com/go-yaml/yaml"
"golang.org/x/crypto/ssh"
)
type acl struct {
Init []string `yaml:"init"`
Read []string `yaml:"read"`
Write []string `yaml:"write"`
}
type AccessControl struct {
Global acl `yaml:"global"`
Groups map[string][]string `yaml:"groups"`
Patterns map[string]acl `yaml:"patterns"`
}
func loadAccessControl(r io.Reader) (*AccessControl, error) {
ac := &AccessControl{}
err := yaml.NewDecoder(r).Decode(ac)
return ac, err
}
// CheckPermission checks if we're supposed to allow the given ssh key. If the
// key is not found error is returned. If it is found, the username it belongs
// to is returned.
func CheckPermission(key ssh.PublicKey) (string, error) {
// stubbed out for now
return "hg", nil
}
// GetPermissions will look up the given username and find the permissions that
// the user has on the given path. It returns 3 bools for read, write, and
// init respectively.
func GetPermissions(username, path string) (bool, bool, bool) {
// stubbed for now
return true, false, false
}