Add Owners to Roles allowed to create projects options on Group
- Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA. As a benefit of being a GitLab Community Contributor, you can request access to GitLab Duo.
What does this MR do and why?
This MR enables a setting that allows the only Owner and a higher role(Admin) to create projects, but disallow Maintainer and lower roles to do it. As a Use Case is described in #354355 (closed), the Terraform user with Owner role can create projects, but other members with lower roles than Owner can't, when we set Owners to Roles allowed to create projects for groups.
Owners option is added into two types of settings.
- Allowed to create projects (Group settings)
Group Page > Settings > General > Permissions and group features > Roles allowed to create projects. - Default project creation protection (admin settings)
Admin Page > Settings > General > Visibility and access controls > Default project creation protection.
IfAllowed to create projectsisn't set, this value is applied. (IfAllowed to create projectsisn't set,Default project creation protectionis automatically selected inAllowed to create projectssection.)
References
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
-
Screenshots of Settings
-
Test that the
Owneroption works.- When
Roles allowed to create projectsisOwners, aMaintaineruser can't create a project. - When
Roles allowed to create projectsisMaintainers, aMaintaineruser can create a project.
- When
How to set up and validate locally
- Create a new test user on gdk (http://gdk.local:3000/).
Please refer to https://docs.gitlab.com/ee/user/profile/account/create_accounts.html. - Open a gdk top page. Click Groups > group name (e.g. Flightjs) > Settings > General > Permissions and group features > Roles allowed to create projects.
- Select
Ownersand clickSave changes. - In the group page, click Manage > Members > Invite members. Select the created test user above in
Username, name or email address, and selectMaintainerinSelect a role. ClickInvite. - Log out from gdk, and log in to gdk as a created test user.
- Click Groups > group name (e.g. Flightjs). Check that
New projectbutton doesn't exist in the upper right corner.
Notes
-
The following shows which combinations of
Access levelandProject creation levelcan create projects.
-
The permission of
Project creation levelis a prerequisite fortransfer projects.- Test of
transfer project- When
Roles allowed to create projectsisOwners, aMaintaineruser can't transfer a project. - When
Roles allowed to create projectsisMaintainers, aMaintaineruser can transfer a project.
- When
- Test of
-
This MR doesn't include changes of
AcceptingProjectCreationsFinderandAcceptingProjectTransfersFinder. This causes the following.
For example, when aMaintaineruser gets groups throughAcceptingProjectCreationsFinder, it returns groups whoseproject_creation_levelisOwner, which means it includes groups in which the user can't create projects.
But in my opinion, it's not a problem. Because if we try to create or transfer projects in the groups without the permission, those services check the permission and return a "no permission" error. (like thetransfer projecttest above) So we can deal with them separately from this issue.



