diff options
author | Bo-Yi Wu <appleboy.tw@gmail.com> | 2017-02-14 20:16:00 +0800 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-02-14 20:16:00 +0800 |
commit | d67b278a0d05e122bf510ac52bfbd69eab4f654d (patch) | |
tree | 28fe4dd05973026013666fd0320a7dea40d94109 /cmd/web.go | |
parent | 23aba523b551d20ee2bbc694ae630989bcdeaccd (diff) | |
download | gitea-d67b278a0d05e122bf510ac52bfbd69eab4f654d.tar.gz gitea-d67b278a0d05e122bf510ac52bfbd69eab4f654d.zip |
feat: Able to disable non-admin to create new organization (#927)
Diffstat (limited to 'cmd/web.go')
-rw-r--r-- | cmd/web.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/cmd/web.go b/cmd/web.go index b793cf0daf..03a87ca0d6 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -345,8 +345,14 @@ func runWeb(ctx *cli.Context) error { // ***** START: Organization ***** m.Group("/org", func() { - m.Get("/create", org.Create) - m.Post("/create", bindIgnErr(auth.CreateOrgForm{}), org.CreatePost) + m.Group("", func() { + m.Get("/create", org.Create) + m.Post("/create", bindIgnErr(auth.CreateOrgForm{}), org.CreatePost) + }, func(ctx *context.Context) { + if !ctx.User.CanCreateOrganization() { + ctx.NotFound() + } + }) m.Group("/:org", func() { m.Get("/dashboard", user.Dashboard) |