diff options
author | Unknown <joe2010xtmf@163.com> | 2014-03-30 16:01:50 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-03-30 16:01:50 -0400 |
commit | 2a0066420a9395e5fa5afcd9be4d094a48eee3fa (patch) | |
tree | 7529650f4c78f9113ac4d9f7f307a4d92255e6cf /serve.go | |
parent | d0e6a4c25acc3414f6d0f93cc50e6dcb41111c19 (diff) | |
download | gitea-2a0066420a9395e5fa5afcd9be4d094a48eee3fa.tar.gz gitea-2a0066420a9395e5fa5afcd9be4d094a48eee3fa.zip |
Fix bug work with sqlite3
Diffstat (limited to 'serve.go')
-rw-r--r-- | serve.go | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -74,29 +74,33 @@ func In(b string, sl map[string]int) bool { func runServ(k *cli.Context) { execDir, _ := base.ExecDir() newLogger(execDir) - log.Trace("new serv request " + log.Mode + ":" + log.Config) base.NewConfigContext() models.LoadModelsConfig() + + if models.UseSQLite3 { + os.Chdir(execDir) + } + models.SetEngine() keys := strings.Split(os.Args[2], "-") if len(keys) != 2 { - fmt.Println("auth file format error") + println("auth file format error") log.Error("auth file format error") return } keyId, err := strconv.ParseInt(keys[1], 10, 64) if err != nil { - fmt.Println("auth file format error") + println("auth file format error") log.Error("auth file format error", err) return } user, err := models.GetUserByKeyId(keyId) if err != nil { - fmt.Println("You have no right to access") - log.Error("SSH visit error", err) + println("You have no right to access") + log.Error("SSH visit error: %v", err) return } @@ -133,13 +137,12 @@ func runServ(k *cli.Context) { // access check switch { case isWrite: - has, err := models.HasAccess(user.Name, strings.ToLower(path.Join(repoUserName, repoName)), models.AU_WRITABLE) + has, err := models.HasAccess(user.LowerName, path.Join(repoUserName, repoName), models.AU_WRITABLE) if err != nil { println("Inernel error:", err) log.Error(err.Error()) return - } - if !has { + } else if !has { println("You have no right to write this repository") log.Error("User %s has no right to write repository %s", user.Name, repoPath) return |