summaryrefslogtreecommitdiffstats
path: root/serve.go
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-03-30 16:01:50 -0400
committerUnknown <joe2010xtmf@163.com>2014-03-30 16:01:50 -0400
commit2a0066420a9395e5fa5afcd9be4d094a48eee3fa (patch)
tree7529650f4c78f9113ac4d9f7f307a4d92255e6cf /serve.go
parentd0e6a4c25acc3414f6d0f93cc50e6dcb41111c19 (diff)
downloadgitea-2a0066420a9395e5fa5afcd9be4d094a48eee3fa.tar.gz
gitea-2a0066420a9395e5fa5afcd9be4d094a48eee3fa.zip
Fix bug work with sqlite3
Diffstat (limited to 'serve.go')
-rw-r--r--serve.go19
1 files changed, 11 insertions, 8 deletions
diff --git a/serve.go b/serve.go
index dcbddfe4a9..96cd7e73de 100644
--- a/serve.go
+++ b/serve.go
@@ -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