-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Conversation
fix #783 |
@@ -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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's u.AllowCreateOrganization?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See https://github.com/go-gitea/gitea/blob/master/models/user.go#L655, It seems it's not used.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
LGTM |
LGTM |
Maybe fix #783
allow_create_organization
ui on edit user pagecc @lunny @tboerger @ethantkoenig