diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2017-05-19 08:59:26 +0800 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-05-19 08:59:26 +0800 |
commit | 6362462da8958980385aad7c8df503d90e13380d (patch) | |
tree | 04b10fe28c10b1de457677ae35555cb91050b235 /modules/context/repo.go | |
parent | 25d6e2a6601f6a8ffd812db35da7692a82044a7f (diff) | |
download | gitea-6362462da8958980385aad7c8df503d90e13380d.tar.gz gitea-6362462da8958980385aad7c8df503d90e13380d.zip |
fix admin lost permission caused by #947
Diffstat (limited to 'modules/context/repo.go')
-rw-r--r-- | modules/context/repo.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/context/repo.go b/modules/context/repo.go index 555513c9e1..a59dc7da28 100644 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -496,11 +496,16 @@ func RequireRepoWriter() macaron.Handler { // LoadRepoUnits loads repsitory's units, it should be called after repository and user loaded func LoadRepoUnits() macaron.Handler { return func(ctx *Context) { + var isAdmin bool + if ctx.User != nil && ctx.User.IsAdmin { + isAdmin = true + } + var userID int64 if ctx.User != nil { userID = ctx.User.ID } - err := ctx.Repo.Repository.LoadUnitsByUserID(userID) + err := ctx.Repo.Repository.LoadUnitsByUserID(userID, isAdmin) if err != nil { ctx.Handle(500, "LoadUnitsByUserID", err) return |