Initial Organization root and dashboard routing
What does this MR do and why?
We introduce the /o/my-organization-path route with the route name of organization_root. Landing on this page is equivalent to rendering root_path but for a given Organization. This route will replace /-/organizations/my-org-path in an upcoming MR.
This work is hidden behind multiple feature flags and is not for general use yet.
URL helpers organization_root_path and organization_root_url become equivalent to root_path and root_url due to earlier work in !197425 (diffs). root_* is referenced in code but will auto-switch to organization_root_* if Current.organization is defined and Organization#scoped_paths? is true.
The content rendered by /o/my-organization-path is the user dashboards so we also adjust the code to render these pages. We have a follow up MR to clean up the content of the dashboard pages so that data is appropriately isolated by Organization.
Note that many of the fixes in the specs are to ensure there's a current Organization context on requests (:with_current_organization), and that the logged in user belongs to that Organization (let(:user) { create(:user, organization: current_organization) }).
References
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. - Visit your Organization using
/o/your-organization-path
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.
Related to #556096 (closed)