API doesn't respect default group visibility
Summary
When creating a new group via the API, the default group visibility is not respected. More specifically, I've set the default group visibility to private but when creating a group using the API, its visibility is set to public.
Steps to reproduce
- Go to https://your-gitlab.com/admin/application_settings
- Set the 'Default group visibility' to Private.
- Create a new group via the API, posting only name and path (not visibility).
What is the current bug behavior?
The group that is created using the API has visibility Public, even though the default group visibility is set to Private.
What is the expected correct behavior?
When the visibility level is not posted in the create group call, I'd expect the new group to have the default group visibility.
Relevant logs and/or screenshots
Set default group visibility:
Group create API call:
curl -X POST https://your-gitlab.com/api/v4/groups \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-H 'private-token: xxxxxxxxxxxxxxxx' \
-d '{
"name": "My Group",
"path": "my-group"
}'
Resulting group visibility:
Output of checks
Since I cannot change the default group visibility on Gitlab.com, I cannot verify if this bug occurs here too.
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: Ubuntu 16.04 Current User: git Using RVM: no Ruby Version: 2.3.3p222 Gem Version: 2.6.6 Bundler Version:1.13.7 Rake Version: 12.0.0 Redis Version: 3.2.5 Git Version: 2.13.5 Sidekiq Version:5.0.4 Go Version: unknown
GitLab information Version: 9.5.1 Revision: c47ae37 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: https://git.xxxxxxxxxxxxxxxxx HTTP Clone URL: https://git.xxxxxxxxxxxxxxxxx/some-group/some-project.git SSH Clone URL: git@git.xxxxxxxxxxxxxxxxx:some-group/some-project.git Using LDAP: no Using Omniauth: no
GitLab Shell Version: 5.8.0 Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check
Checking GitLab Shell ...
GitLab Shell version >= 5.8.0 ? ... OK (5.8.0) Repo base directory exists? default... yes Repo storage directories are symlinks? default... no Repo paths owned by git:root, or git:git? default... yes Repo paths access is drwxrws---? default... yes hooks directories in repos are links: ... 2/1 ... ok 2/2 ... ok 2/3 ... ok 2/4 ... ok 3/5 ... ok 4/6 ... ok 8/7 ... ok 8/8 ... ok 8/9 ... ok 8/10 ... ok 2/11 ... ok 2/12 ... ok 8/13 ... ok 9/14 ... ok 8/15 ... ok 8/16 ... ok 8/17 ... ok 8/18 ... ok 8/19 ... ok 2/20 ... ok 8/21 ... ok 8/22 ... ok 2/23 ... ok 8/24 ... ok 8/25 ... ok 8/26 ... ok 8/27 ... ok 10/28 ... ok 11/29 ... ok 8/30 ... ok 8/31 ... ok 8/32 ... ok 10/33 ... ok 2/34 ... ok 8/35 ... ok 2/36 ... ok 8/37 ... ok 2/38 ... ok 8/39 ... ok 11/40 ... ok 8/41 ... ok 8/42 ... ok 2/43 ... ok 2/44 ... ok 2/45 ... ok 12/46 ... ok 2/47 ... ok 12/48 ... ok 12/49 ... ok 12/50 ... ok 12/51 ... ok 12/52 ... ok 2/53 ... ok 2/54 ... ok 8/55 ... ok 8/56 ... ok 2/57 ... ok 13/58 ... ok 8/59 ... ok 23/76 ... ok 23/77 ... ok 23/78 ... ok 23/85 ... ok 23/86 ... ok 23/87 ... ok 23/88 ... ok 12/89 ... ok 12/90 ... ok 9/91 ... ok 26/94 ... ok 12/95 ... ok 29/96 ... ok 29/97 ... ok 29/98 ... ok 29/99 ... ok 29/100 ... ok 29/101 ... ok 12/102 ... ok 12/103 ... ok 12/104 ... ok 12/105 ... ok 24/107 ... ok 24/108 ... ok 24/109 ... ok 24/110 ... ok 99/111 ... ok 113/112 ... ok 115/113 ... ok 118/114 ... ok 124/115 ... ok 130/116 ... ok 133/117 ... ok 90/118 ... ok 133/119 ... ok Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Access to /var/opt/gitlab/.ssh/authorized_keys: OK Send ping to redis server: OK gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking Reply by email ...
Reply by email is disabled in config/gitlab.yml
Checking Reply by email ... Finished
Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
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? ... yes 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: ... 2/1 ... yes 2/2 ... yes 2/3 ... yes 2/4 ... yes 3/5 ... yes 4/6 ... yes 8/7 ... yes 8/8 ... yes 8/9 ... yes 8/10 ... yes 2/11 ... yes 2/12 ... yes 8/13 ... yes 9/14 ... yes 8/15 ... yes 8/16 ... yes 8/17 ... yes 8/18 ... yes 8/19 ... yes 2/20 ... yes 8/21 ... yes 8/22 ... yes 2/23 ... yes 8/24 ... yes 8/25 ... yes 8/26 ... yes 8/27 ... yes 10/28 ... yes 11/29 ... yes 8/30 ... yes 8/31 ... yes 8/32 ... yes 10/33 ... yes 2/34 ... yes 8/35 ... yes 2/36 ... yes 8/37 ... yes 2/38 ... yes 8/39 ... yes 11/40 ... yes 8/41 ... yes 8/42 ... yes 2/43 ... yes 2/44 ... yes 2/45 ... yes 12/46 ... yes 2/47 ... yes 12/48 ... yes 12/49 ... yes 12/50 ... yes 12/51 ... yes 12/52 ... yes 2/53 ... yes 2/54 ... yes 8/55 ... yes 8/56 ... yes 2/57 ... yes 13/58 ... yes 8/59 ... yes 23/76 ... yes 23/77 ... yes 23/78 ... yes 23/85 ... yes 23/86 ... yes 23/87 ... yes 23/88 ... yes 12/89 ... yes 12/90 ... yes 9/91 ... yes 26/94 ... yes 12/95 ... yes 29/96 ... yes 29/97 ... yes 29/98 ... yes 29/99 ... yes 29/100 ... yes 29/101 ... yes 12/102 ... yes 12/103 ... yes 12/104 ... yes 12/105 ... yes 24/107 ... yes 24/108 ... yes 24/109 ... yes 24/110 ... yes 99/111 ... yes 113/112 ... yes 115/113 ... yes 118/114 ... yes 124/115 ... yes 130/116 ... yes 133/117 ... yes 90/118 ... yes 133/119 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.3 ? ... yes (2.3.3) Git version >= 2.7.3 ? ... yes (2.13.5) Active users: ... 37
Checking GitLab ... Finished