diff options
author | Unknwon <u@gogs.io> | 2017-02-10 16:41:51 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2017-02-10 16:41:51 -0500 |
commit | b67ec01d41ad9d504d80ffb950e161b9ce0841fc (patch) | |
tree | 1ee963dcee6daa7bcb6c221fb64cd587f69b88c2 /cmd | |
parent | 2c154ccbe7d3d4f038885eb439c36bb9fd533e53 (diff) |
Able to disable non-admin to create new organization (#1556)
Add new config option '[admin] DISABLE_REGULAR_ORG_CREATION', by
default it's 'false'.
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/web.go | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -362,8 +362,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) |