From df339ad8b0c4f8858a53a4890ded97a1e3208b13 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Wed, 18 Nov 2015 19:49:11 -0500 Subject: #1401 #493 Admin should be able to see private repositories --- modules/middleware/repo.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'modules') 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 { -- cgit v1.2.3