Reputation: 741
I have setup GitLab 7.12 in my firm. But users start creating groups (and groups and groups ...) and it will become a total mess very soon. Does anyone know how to restrict groups creation to administrators of the platform ?
The idea is to have people creating projects in their personal space, and reserving groups for official ones.
Upvotes: 10
Views: 10877
Reputation: 1325137
GitLab 15.5 (October 2022) can help:
Admin Area setting to prevent users from creating groups
GitLab administrators can now use the Admin Area to disable users’ permission to create top-level groups. Previously, administrators with access to the instance’s file system could change this setting only in the
gitlab.rb
file.See Documentation and Issue.
issue 367754: "Shift option to prevent users from creating groups to Instance Admin UI", resolved with MR 2763:
Deprecate
default_can_create_group
settingIn MR 96746 (merged), we are migrating the setting
default_can_create_group
and its current value from the configuration file to the UI/API and hence this setting cannot be controlled via the configuration file anymore.
And:
Make this setting available in
ApplicationSetting
, so that an Admin can control this setting via the UI/API and does not have to change the value in thegitlab.yml
file anymore.Moving this setting to
ApplicationSetting
would also mean that GitLab admins won't have to restart the instance for the change to take effect.
Hence the notice:
global.appConfig.defaultCanCreateGroup
setting has been deprecated.Starting with GitLab 15.5, this setting cannot be controlled via the configuration file anymore.
Follow the steps at Account and limit settings, to configure this setting via the Admin UI or the API.
Upvotes: 1
Reputation: 59
In regard to helm deployment, changing this on the config is not available anymore, https://gitlab.com/gitlab-org/charts/gitlab/-/blob/master/templates/NOTES.txt#L138
`global.appConfig.defaultCanCreateGroup` setting has been deprecated. Starting with GitLab 15.5, this setting cannot be controlled via the configuration file anymore. Follow the steps at https://docs.gitlab.com/ee/user/admin_area/settings/account_and_limit_settings.html#prevent-users-from-creating-top-level-groups, to configure this setting via the Admin UI or the API.
Upvotes: 0
Reputation: 61
For existing users, you can also use the following command on gitlab-rails console:
irb(main):001:0> User.update_all can_create_group:false
Upvotes: 6
Reputation: 438
For old users, the GitLab Users API: User modification (a REST API) can also be used for this purpose (set the value of can_create_group
to false
) and can be easily used for bulk changes in a for loop:
curl --request PUT https://gitlab.example.com/api/v4/users/:id?can_create_group=false
Note: Please have a look at available authentication methods at GitLab API Authentication.
Upvotes: 2
Reputation: 21
And for old users, use something like (in rails console):
irb(main):012:0> @users.each do |u|
irb(main):013:1* u.can_create_group= false
irb(main):014:1> u.save
irb(main):015:1> end
Upvotes: 2
Reputation: 835
For an Omnibus install, the correct place is:
/etc/gitlab/gitlab.rb
gitlab_rails['gitlab_default_can_create_group'] = false
Then you'll need to execute sudo gitlab-ctl reconfigure
and sudo gitlab-ctl restart
to apply the changes.
Upvotes: 21
Reputation: 3073
If you want to disable group creation for new users, at the moment you will have to edit the gitlab.yml
, specifically the setting default_can_create_group
, and set it to false
.
Upvotes: 7