fix admin lost permission caused by #947
This commit is contained in:
parent
25d6e2a660
commit
6362462da8
4 changed files with 14 additions and 9 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue