Gitlab Bulk Update can_create_group

I had been allowing normal users to create groups within Gitlab but subsequently discovered some confusion among users between groups and projects. Some users had been creating a group with a single project when a project with multiple members was more suitable.

A decided to update the Gitlab CE database to amend the users table and set the field can_create_groups to false for all existing users. First connect to the postgres database:

su - gitlab-psql

And connec tot the database via the local unix socket:

/opt/gitlab/embedded/bin/psql -h /var/opt/gitlab/postgresql/    gitlabhq_production

I checked the field names in the users table with:

\d+ users;

Then I performed a few counts to check the existing users:

SELECT COUNT(*) FROM users WHERE can_create_group=false;

Then I amended the users who could currently create groups with:

UPDATE users SET can_create_group=false WHERE can_create_group=true;

I did my counts again and saw that zero users now had that field set to true. So I added my own account and a few other admin users to allow them to create groups e.g.

SELECT COUNT(*) FROM users WHERE can_create_group=true WHERE email='admin.user@domain.tld';


Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>