Skip to content

Draft: Explicitly pass Organization when importing projects

Rutger Wessels requested to merge 443338-pass-organization_id-groups-import into master

What does this MR do and why?

As part of Cells project, we are working on adding support for Organizations. One of the implications is that Groups should be assigned an Organization.

In this MR, we started to use Current.organization which will be set by future Cells router. However, Current is set in Rack Middleware and usage should be limited to request layer (controllers)

So we need to adapt all code paths that are using Groups::CreateService. In order to keep the MR's small, I decided to create a series of MR's:

MR Description
!149109 (merged) Pass organization explicitly for manually creation of groups
This MR Pass organization explicitly for group creation related to import
TODO Remaining code paths
!149111 Clean up
  • For lib/api/group_import.rb, we will rely on Current.organization, which will be set by the Router logic
  • For Bulk import, things are a little bit more complicated. I added an organization_id field to bulk_import_entities and use that

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.

How to set up and validate locally

I setup a simple group 'rutger-test-group' on staging and created a Personal Access Token for the staging user. I removed this token right after the test.

On local GDK, created a new group using http://localhost:3000/groups/new:

Then I selected the 'rutger-test-group' group and imported it. I had to restart GDK one time but then the project and groups showed up in my local environment with the correct organization_id

Related to #443338

Edited by Rutger Wessels

Merge request reports