Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix default for allowing new organization creation for new users #7017

Merged
merged 3 commits into from
May 24, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions models/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -849,10 +849,9 @@ func CreateUser(u *User) (err error) {
return err
}
u.HashPassword(u.Passwd)
u.AllowCreateOrganization = setting.Service.DefaultAllowCreateOrganization
u.AllowCreateOrganization = setting.Service.DefaultAllowCreateOrganization && !setting.Admin.DisableRegularOrgCreation
u.MaxRepoCreation = -1
u.Theme = setting.UI.DefaultTheme
u.AllowCreateOrganization = !setting.Admin.DisableRegularOrgCreation

if _, err = sess.Insert(u); err != nil {
return err
Expand Down
2 changes: 2 additions & 0 deletions models/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ func TestCreateUser_Issue5882(t *testing.T) {
{&User{Name: "GiteaBot2", Email: "GiteaBot2@gitea.io", Passwd: passwd, MustChangePassword: false}, true},
}

setting.Service.DefaultAllowCreateOrganization = true

for _, v := range tt {
setting.Admin.DisableRegularOrgCreation = v.disableOrgCreation

Expand Down