diff options
Diffstat (limited to 'modules/middleware/repo.go')
-rw-r--r-- | modules/middleware/repo.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go index 7c99d2d0..3e1835f5 100644 --- a/modules/middleware/repo.go +++ b/modules/middleware/repo.go @@ -140,7 +140,7 @@ func RepoAssignment(args ...bool) macaron.Handler { ctx.Data["Owner"] = ctx.Repo.Repository.Owner ctx.Data["IsRepositoryOwner"] = ctx.Repo.IsOwner() ctx.Data["IsRepositoryAdmin"] = ctx.Repo.IsAdmin() - ctx.Data["IsRepositoryPusher"] = ctx.Repo.IsPusher() + ctx.Data["IsRepositoryWriter"] = ctx.Repo.IsWriter() if repo.IsFork { RetrieveBaseRepo(ctx, repo) @@ -150,7 +150,7 @@ func RepoAssignment(args ...bool) macaron.Handler { } // People who have push access and propose a new pull request. - if ctx.Repo.IsPusher() { + if ctx.Repo.IsWriter() { // Pull request is allowed if this is a fork repository // and base repository accepts pull requests. if repo.BaseRepo != nil { @@ -336,16 +336,16 @@ func RepoRef() macaron.Handler { func RequireRepoAdmin() macaron.Handler { return func(ctx *Context) { - if !ctx.Repo.IsAdmin() { + if !ctx.IsSigned || (!ctx.Repo.IsAdmin() && !ctx.User.IsAdmin) { ctx.Handle(404, ctx.Req.RequestURI, nil) return } } } -func RequireRepoPusher() macaron.Handler { +func RequireRepoWriter() macaron.Handler { return func(ctx *Context) { - if !ctx.Repo.IsPusher() { + if !ctx.IsSigned || (!ctx.Repo.IsWriter() && !ctx.User.IsAdmin) { ctx.Handle(404, ctx.Req.RequestURI, nil) return } |