Gitlab Custom Group Role Permission Not displayed When Custom Role is Created In UI

Summary

If you created a custom group role in the UI, as apposed to with the API, the permissions do not show up in the UI.

Steps to reproduce

  1. On the left sidebar, at the bottom, select Admin Area.
  2. Select Settings > Roles and Permissions.
  3. From the top dropdown list, select the group you want to create a custom role in.
  4. Select Add new role.
  5. In Base role to use as template, select an existing non-custom role.
  6. In Role name, enter the custom role’s title.
  7. Optional. In Description, enter a description for the custom role.
  8. Select the Permissions for the new custom role.
  9. Select Create new role.

Note that the permissions are not present in the resulting view:

Screenshot 2024-01-30 at 15.16.42.png

However, if you do this with an API call, you get permissions displayed in the UI:

% curl --request POST --header "Content-Type: application/json" --header "Authorization: Bearer glpat-REDACTED" --data '{"name" : "Custom developer", "base_access_level" : 30, "read_code" : true}' "https://sr-env-92cf8052-omni.env-92cf8052.gcp.gitlabsandbox.net/api/v4/groups/2/member_roles" 
{
"id":3,
"group_id":2,
"name":"Custom developer",
"description":null,
"base_access_level":30,
"admin_group_member":false,
"admin_merge_request":false,
"admin_vulnerability":false,
"archive_project":false,
"manage_project_access_tokens":false,
"read_code":true,
"read_dependency":false,
"read_vulnerability":false
}"%"

Screenshot 2024-01-30 at 15.27.15.png

Example Project

I don't have admin in GitLab.com so I tested this on an ultimate instance first running GitLab 16.7.2. I then upgraded to first 16.7.4 then to version 16.8.1 and the problem does not go away.

What is the current bug behavior?

The role permissions are not showing up when creating this the UI

What is the expected correct behavior?

The role permissions should be showing up in the UI regardless of whether this is created in the UI or with the API.

Relevant logs and/or screenshots

See above in the steps to reproduce

Output of checks

Results of GitLab environment info

System information
System:		Ubuntu 20.04
Proxy:		no
Current User:	git
Using RVM:	no
Ruby Version:	3.1.4p223
Gem Version:	3.4.22
Bundler Version:2.4.22
Rake Version:	13.0.6
Redis Version:	7.0.14
Sidekiq Version:6.5.12
Go Version:	unknown

GitLab information
Version:	16.7.2-ee
Revision:	847f5d82ad6
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	14.9
URL:		https://sr-env-92cf8052-omni.env-92cf8052.gcp.gitlabsandbox.net
HTTP Clone URL:	https://sr-env-92cf8052-omni.env-92cf8052.gcp.gitlabsandbox.net/some-group/some-project.git
SSH Clone URL:	git@sr-env-92cf8052-omni.env-92cf8052.gcp.gitlabsandbox.net:some-group/some-project.git
Elasticsearch:	no
Geo:		no
Using LDAP:	no
Using Omniauth:	yes
Omniauth Providers:

GitLab Shell
Version:	14.32.0
Repository storages:
- default: 	unix:/var/opt/gitlab/gitaly/gitaly.socket
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell

Gitaly
- default Address: 	unix:/var/opt/gitlab/gitaly/gitaly.socket
- default Version: 	16.7.2
- default Git Version: 	2.42.0

Results of GitLab application Check

GitLab Shell: ... GitLab Shell version >= 14.32.0 ? ... OK (14.32.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 (cluster/worker) ... 1/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 ...

Database config exists? ... yes
Tables are truncated? ... skipped
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config up to date? ... yes
Cable config exists? ... yes
Resque config exists? ... 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)
Systemd unit files or init script exist? ... skipped (omnibus-gitlab has neither init script nor systemd units)
Systemd unit files or init script up-to-date? ... skipped (omnibus-gitlab has neither init script nor systemd units)
Projects have namespace: ...
2/1 ... yes
Redis version >= 6.0.0? ... yes
Ruby version >= 3.0.6 ? ... yes (3.1.4)
Git user has default SSH configuration? ... yes
Active users: ... 1
Is authorized keys file accessible? ... yes
GitLab configured to store new projects in hashed storage? ... yes
All projects are in hashed storage? ... yes
Elasticsearch version 7.x-8.x or OpenSearch version 1.x ... skipped (Advanced Search is disabled)
All migrations must be finished before doing a major upgrade ... skipped (Advanced Search is disabled)

Checking GitLab App ... Finished


Checking GitLab subtasks ... Finished

Possible fixes