summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gogs.go2
-rw-r--r--models/access.go20
-rw-r--r--modules/middleware/repo.go2
-rw-r--r--templates/.VERSION2
4 files changed, 13 insertions, 13 deletions
diff --git a/gogs.go b/gogs.go
index af403e0006..4e3cf117d2 100644
--- a/gogs.go
+++ b/gogs.go
@@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting"
)
-const APP_VER = "0.7.18.1118 Beta"
+const APP_VER = "0.7.18.1119 Beta"
func init() {
runtime.GOMAXPROCS(runtime.NumCPU())
diff --git a/models/access.go b/models/access.go
index 8a7729b734..5eef32819e 100644
--- a/models/access.go
+++ b/models/access.go
@@ -36,19 +36,19 @@ func accessLevel(e Engine, u *User, repo *Repository) (AccessMode, error) {
mode = ACCESS_MODE_READ
}
- if u != nil {
- if u.Id == repo.OwnerID {
- return ACCESS_MODE_OWNER, nil
- }
+ if u == nil {
+ return mode, nil
+ }
- a := &Access{UserID: u.Id, RepoID: repo.ID}
- if has, err := e.Get(a); !has || err != nil {
- return mode, err
- }
- return a.Mode, nil
+ if u.Id == repo.OwnerID {
+ return ACCESS_MODE_OWNER, nil
}
- return mode, nil
+ a := &Access{UserID: u.Id, RepoID: repo.ID}
+ if has, err := e.Get(a); !has || err != nil {
+ return mode, err
+ }
+ return a.Mode, nil
}
// AccessLevel returns the Access a user has to a repository. Will return NoneAccess if the
diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go
index a78e079d8d..7780fa5cd5 100644
--- a/modules/middleware/repo.go
+++ b/modules/middleware/repo.go
@@ -275,7 +275,7 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
}
// Admin has super access.
- if ctx.User.IsAdmin {
+ if ctx.IsSigned && ctx.User.IsAdmin {
ctx.Repo.AccessMode = models.ACCESS_MODE_OWNER
} else {
mode, err := models.AccessLevel(ctx.User, repo)
diff --git a/templates/.VERSION b/templates/.VERSION
index a2ed39f2d9..aa65a45b56 100644
--- a/templates/.VERSION
+++ b/templates/.VERSION
@@ -1 +1 @@
-0.7.18.1118 Beta \ No newline at end of file
+0.7.18.1119 Beta \ No newline at end of file