summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-11-18 19:49:11 -0500
committerUnknwon <u@gogs.io>2015-11-18 19:49:11 -0500
commitdf339ad8b0c4f8858a53a4890ded97a1e3208b13 (patch)
treef177b12a8586fc820756f4ee9bcd9e04b7e1829f /modules
parent2c653141a83eb5bc3fb1baaff0449195b9e1f6a6 (diff)
downloadgitea-df339ad8b0c4f8858a53a4890ded97a1e3208b13.tar.gz
gitea-df339ad8b0c4f8858a53a4890ded97a1e3208b13.zip
#1401 #493 Admin should be able to see private repositories
Diffstat (limited to 'modules')
-rw-r--r--modules/middleware/repo.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go
index c7481743d4..a78e079d8d 100644
--- a/modules/middleware/repo.go
+++ b/modules/middleware/repo.go
@@ -274,19 +274,23 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
return
}
- mode, err := models.AccessLevel(ctx.User, repo)
- if err != nil {
- ctx.Handle(500, "AccessLevel", err)
- return
+ // Admin has super access.
+ if ctx.User.IsAdmin {
+ ctx.Repo.AccessMode = models.ACCESS_MODE_OWNER
+ } else {
+ mode, err := models.AccessLevel(ctx.User, repo)
+ if err != nil {
+ ctx.Handle(500, "AccessLevel", err)
+ return
+ }
+ ctx.Repo.AccessMode = mode
}
- ctx.Repo.AccessMode = mode
// Check access.
if ctx.Repo.AccessMode == models.ACCESS_MODE_NONE {
ctx.Handle(404, "no access right", err)
return
}
-
ctx.Data["HasAccess"] = true
if repo.IsMirror {