Skip to content

feat: Able to disable non-admin to create new organization #927

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

Merged
merged 1 commit into from
Feb 14, 2017

Conversation

appleboy
Copy link
Member

@appleboy appleboy commented Feb 14, 2017

Maybe fix #783

  • support disable non-admin to create new organization
  • hide allow_create_organization ui on edit user page
  • add unit testing

screen shot 2017-02-14 at 3 46 00 pm

cc @lunny @tboerger @ethantkoenig

@lunny lunny added this to the 1.1.0 milestone Feb 14, 2017
@lunny lunny added type/enhancement An improvement of existing functionality type/feature Completely new functionality. Can only be merged if feature freeze is not active. labels Feb 14, 2017
@lunny
Copy link
Member

lunny commented Feb 14, 2017

fix #783

@tboerger tboerger added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 14, 2017
@@ -223,7 +223,7 @@ func (u *User) CanCreateRepo() bool {

// CanCreateOrganization returns true if user can create organisation.
func (u *User) CanCreateOrganization() bool {
return u.IsAdmin || u.AllowCreateOrganization
return u.IsAdmin || (u.AllowCreateOrganization && !setting.Admin.DisableRegularOrgCreation)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's u.AllowCreateOrganization?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

screen shot 2017-02-14 at 4 35 46 pm

last item.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Admin can disable permission of a user. so hide this item if DISABLE_REGULAR_ORG_CREATION as true

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And I think maybe you could let this option disabled and default value is setting.Admin.DisableRegularOrgCreation when setting.Admin.DisableRegularOrgCreation is false and change https://github.com/go-gitea/gitea/blob/master/models/user.go#L655 to the UI form's value?

Copy link
Member Author

@appleboy appleboy Feb 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default value as true makes sense for me. Admin needs to update all user setting if you set DisableRegularOrgCreation as false again.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But even that, it should be the value on the UI?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. That's update user.

@tboerger
Copy link
Member

LGTM

@tboerger tboerger added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Feb 14, 2017
@lunny
Copy link
Member

lunny commented Feb 14, 2017

LGTM

@tboerger tboerger added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Feb 14, 2017
@lunny lunny merged commit d67b278 into go-gitea:master Feb 14, 2017
@appleboy appleboy deleted the org2 branch February 14, 2017 13:44
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/enhancement An improvement of existing functionality type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add global setting for org creation
3 participants