aboutsummaryrefslogtreecommitdiff
path: root/models
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 /models
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 'models')
-rw-r--r--models/user.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/models/user.go b/models/user.go
index 4b44a513..6a7365ab 100644
--- a/models/user.go
+++ b/models/user.go
@@ -170,6 +170,10 @@ func (u *User) CanCreateRepo() bool {
return u.NumRepos < u.MaxRepoCreation
}
+func (u *User) CanCreateOrganization() bool {
+ return !setting.Admin.DisableRegularOrgCreation || u.IsAdmin
+}
+
// CanEditGitHook returns true if user can edit Git hooks.
func (u *User) CanEditGitHook() bool {
return u.IsAdmin || u.AllowGitHook