Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent group creation in GitLab

Tags:

gitlab

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.

like image 632
Gurvan Avatar asked Oct 20 '15 14:10

Gurvan


People also ask

How do I change the group of a project in GitLab?

Transferring an existing project into a group You can transfer an existing project into a group you own from the project settings page. First scroll down to the 'Dangerous settings' and click 'Show them to me'. Now you can pick any of the groups you manage as the new namespace for the group.

Can create groups GitLab?

Create a Group in GitLabGitLab's interface makes it simple for new users to create groups. Tap on the Menu button, navigate to the Groups tab, and click Create group . At this point, we can create a new group from scratch or use an existing GitLab instance.

Can a GitLab group have multiple owners?

Because one user cannot "own" another namespace (not even admins), the only option to set up a scenario where two users own the same namespace is with a group.


5 Answers

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.

like image 193
Silviu Avatar answered Oct 24 '22 01:10

Silviu


  1. Enter the Admin control panel
  2. Select 'Users'
  3. Select the user(s) in question and click 'Edit'
  4. Scroll down to 'Access' and un-tick 'Can Create Group'

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.

See gitlab.yml#L63@712d1768.

like image 22
Stuart Grassie Avatar answered Oct 24 '22 03:10

Stuart Grassie


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
like image 5
Dasova Avatar answered Oct 24 '22 02:10

Dasova


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
like image 2
Younès Ouchtouban Avatar answered Oct 24 '22 03:10

Younès Ouchtouban


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.

like image 2
alleen1 Avatar answered Oct 24 '22 02:10

alleen1