Cannot update external flag and can_create_group at once

Summary

At the moment, you have to perform the same request twice to set an user as 'external' and to allow it to create groups.

Steps to reproduce

  1. Create an user, e.g.:
{
  "id": 187,
  "name": "bar 3413192909964844354",
  "username": "foo",
  "state": "active",
  "avatar_url": "https://www.gravatar.com/avatar/6cb7a4757a4ddc29398423c969865348?s=80&d=identicon",
  "web_url": "http://localhost/foo",
  "created_at": "2020-02-24T11:11:51.864Z",
  "bio": null,
  "location": null,
  "public_email": "",
  "skype": "",
  "linkedin": "",
  "twitter": "",
  "website_url": "",
  "organization": null,
  "last_sign_in_at": null,
  "confirmed_at": "2020-02-24T11:11:51.763Z",
  "last_activity_on": null,
  "email": "foo@bar.it",
  "theme_id": 1,
  "color_scheme_id": 1,
  "projects_limit": 10000,
  "current_sign_in_at": null,
  "identities": [],
  "can_create_group": false,
  "can_create_project": true,
  "two_factor_enabled": false,
  "external": false,
  "private_profile": false,
  "is_admin": false,
  "highest_role": 0
}
  1. Update the external and can_create_group fields:
$ curl -s -H "Private-Token: $GITLAB_TOKEN" $GITLAB_HOST/api/v4/users/187 -d '{"external": true, "can_create_group": true}' -H 'Content-Type: application/json' -X PUT
  1. This is the resulting user:
{
  "id": 187,
  "name": "bar 3413192909964844354",
  "username": "foo",
  "state": "active",
  "avatar_url": "https://www.gravatar.com/avatar/d4d7d0bf42958788293812fc44013e52?s=80&d=identicon",
  "web_url": "http://localhost/foo",
  "created_at": "2020-02-24T11:11:51.864Z",
  "bio": null,
  "location": null,
  "public_email": "",
  "skype": "",
  "linkedin": "",
  "twitter": "",
  "website_url": "",
  "organization": null,
  "last_sign_in_at": null,
  "confirmed_at": "2020-02-24T11:11:51.763Z",
  "last_activity_on": null,
  "email": "listest3413192909964844354@tttt.com",
  "theme_id": 1,
  "color_scheme_id": 1,
  "projects_limit": 0,
  "current_sign_in_at": null,
  "identities": [],
  "can_create_group": false,
  "can_create_project": false,
  "two_factor_enabled": false,
  "external": true,
  "private_profile": false,
  "is_admin": true
}
  1. Update the external and can_create_group fields again:
$ curl -s -H "Private-Token: $GITLAB_TOKEN" $GITLAB_HOST/api/v4/users/187 -d '{"external": true, "can_create_group": true}' -H 'Content-Type: application/json' -X PUT
  1. This is the resulting user:
{
  "id": 187,
  "name": "bar 3413192909964844354",
  "username": "foo",
  "state": "active",
  "avatar_url": "https://www.gravatar.com/avatar/d4d7d0bf42958788293812fc44013e52?s=80&d=identicon",
  "web_url": "http://localhost/foo",
  "created_at": "2020-02-24T11:11:51.864Z",
  "bio": null,
  "location": null,
  "public_email": "",
  "skype": "",
  "linkedin": "",
  "twitter": "",
  "website_url": "",
  "organization": null,
  "last_sign_in_at": null,
  "confirmed_at": "2020-02-24T11:11:51.763Z",
  "last_activity_on": null,
  "email": "listest3413192909964844354@tttt.com",
  "theme_id": 1,
  "color_scheme_id": 1,
  "projects_limit": 0,
  "current_sign_in_at": null,
  "identities": [],
  "can_create_group": true,
  "can_create_project": false,
  "two_factor_enabled": false,
  "external": true,
  "private_profile": false,
  "is_admin": true
}

What is the current bug behavior?

You need to perform the same request twice to update projects_limit, can_create_group and can_create_project fields when the user is set to external.

What is the expected correct behavior?

Other fields are updated in the first request as well.

Results of GitLab environment info

Expand for output related to GitLab environment info
System information
System:		
Current User:	git
Using RVM:	no
Ruby Version:	2.6.5p114
Gem Version:	2.7.10
Bundler Version:1.17.3
Rake Version:	12.3.3
Redis Version:	5.0.7
Git Version:	2.24.1
Sidekiq Version:5.2.7
Go Version:	unknown

GitLab information Version: 12.7.6 Revision: 61654d25b20 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 10.9 URL: http://localhost HTTP Clone URL: http://localhost/some-group/some-project.git SSH Clone URL: git@localhost:some-group/some-project.git Using LDAP: no Using Omniauth: yes Omniauth Providers:

GitLab Shell Version: 11.0.0 Repository storage paths:

  • default: /var/opt/gitlab/git-data/repositories GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell Git: /opt/gitlab/embedded/bin/git

Results of GitLab application Check

Expand for output related to the GitLab application check
Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 11.0.0 ? ... OK (11.0.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... yes Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Reply by email is disabled in config/gitlab.yml

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab App ...

Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... skipped (no tmp uploads folder yet) Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... can't check, you have no projects Redis version >= 2.8.0? ... yes Ruby version >= 2.5.3 ? ... yes (2.6.5) Git version >= 2.22.0 ? ... yes (2.24.1) Git user has default SSH configuration? ... yes Active users: ... 2 Is authorized keys file accessible? ... yes

Checking GitLab App ... Finished

Checking GitLab subtasks ... Finished

Edited Feb 26, 2020 by Andrea Scarpino
Assignee Loading
Time tracking Loading