Group created with public visibility when visibility restricted
Summary
When GitLab CE 11.3.0 is configured with "Default group visibility" set to "Internal" and "Restricted visibility levels" with "Internal" and "Public" checked, creating a new group gives the group "Public" visibility.
Steps to reproduce
- As an admin user, set "Default group visibility" to "Internal"
- As an admin user, set "Restricted visibility levels" with "Internal" and "Public" checked
- As an admin user, set "Restricted visibility levels" with "Private" unchecked
- As non-admin user who can make new groups, make a new group with the "Visibility Level" radio button set to "Internal" (It is set to the default value of internal, even though it is greyed out and is a restricted visibility.)
What is the current bug behavior?
The new group has a "Visibility Level" of "Public" even though "Public" is restricted.
What is the expected correct behavior?
The new group has a "Visibility Level" of "Internal".
Relevant logs and/or screenshots
Results of GitLab environment info
I'm running GitLab on NixOS so some of these aren't working:
System information
System:
Current User: root
Using RVM: no
Ruby Version: unknown
Gem Version:
Bundler Version:1.16.3
Rake Version: 12.3.1
Redis Version: unknown
Git Version: 2.18.0
Sidekiq Version:5.1.3
Go Version: unknown
GitLab information
Version: 11.3.0
Revision: Unknown
Directory: /nix/store/aqbwjynr52bwrb5d5158ka2nnakhhfyd-gitlab-11.3.0/share/gitlab
DB Adapter: postgresql
Using LDAP: yes
Using Omniauth: no
GitLab Shell
Version: 8.3.3
Repository storage paths:
- default: /var/gitlab/state/repositories
Hooks: /var/gitlab/state/shell/hooks
Git: git
Possible fixes
https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/models/group.rb#L161
If I allow "Internal" to be unrestricted, then visit the new group form, then change the setting to restrict "Internal" in another tab, then attempting to create the group fails with a good error message. Then, if I click create group again, it succeeds with "Public" visibility.