aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2017-02-10 16:41:51 -0500
committerUnknwon <u@gogs.io>2017-02-10 16:41:51 -0500
commitb67ec01d41ad9d504d80ffb950e161b9ce0841fc (patch)
tree1ee963dcee6daa7bcb6c221fb64cd587f69b88c2 /cmd
parent2c154ccbe7d3d4f038885eb439c36bb9fd533e53 (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.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/cmd/web.go b/cmd/web.go
index fa338376..9ed63289 100644
--- a/cmd/web.go
+++ b/cmd/web.go
@@ -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)