Skip to content

Ensure Organization is set while creating a new Group

Rutger Wessels requested to merge 411832-namespace-required into master

What does this MR do and why?

Currently, we have a column organization_id in namespaces table that is defined as DEFAULT 1 NULL: it is allowed to be NULL and it defaults to 1. But we don't want to rely on the default organization. When we introduce Organizations in the UI, we should explicitly assign an Organization to a Namespace.

This MR adds a Groups::Create.set_organization method that runs if we did not assign an Organization to the groep. It works like this:

  • If a group is not a root group, it will use the organization of the parent group.
  • If a group is a root group, it will use the current organization and fallback to default organization

The code is executed for new groups only

Related to #411832

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.

Edited by Rutger Wessels

Merge request reports