Route new/create project through Org scope
What does this MR do and why?
- Adds Organization scoped routes for new and create project
- Only applies to Organizations that are not the Default Organization.
- Automatically maps global URL helpers to Organization URL helpers
- Defines a way forward for further Organization scoped routes - there are many to come
There is a more detailed description of Organization paths in the Organization Path Scope ADR.
The primary changes are:
-
app/helpers/routing/organizations_helper.rb
overrides the global route helpers that have an Organization equivalent. -
config/routes/organizations.rb
is where we create the/o/
Organization scoped routes.
The URL helper overrides can not be placed behind a feature flag because it's part of the Ruby on Rails initialization process. However the select of global vs Organization scoped paths by the modified URL helpers are behind a feature flag.
Relates to #553914 (closed)
References
- Organization path scope - https://handbook.gitlab.com/handbook/engineering/architecture/design-documents/organization/decisions/004_path_scope/
- Organization context resolution - https://handbook.gitlab.com/handbook/engineering/architecture/design-documents/organization/decisions/001_organization_context_resolution/
- Current organization - https://handbook.gitlab.com/handbook/engineering/architecture/design-documents/organization/current_organization/
Screenshots or screen recordings
Before | After |
---|---|
![]() |
![]() |
![]() |
![]() |
How to set up and validate locally
- In rails console enable the feature flag
Feature.enable :allow_organization_creation
Feature.enable :organization_switching
Feature.enable :ui_for_organizations
Feature.enable :organization_scoped_paths
- Create an Organization through the
+
sidebar button. - Navigate to Organization Groups & Projects
- Create a group through the
New group
button - From within that Group click the
New project
button and observe the URL is/o/
Organization scoped. - Create a project and observe the project is successfully created within the group.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Rémy Coutable