Remove usage of Current.organization from Groups::CreateService class
In Groups::CreateService
class, we use Current.organization
. But we shouldn't, see this issue for context
Solution
Find usages of Groups::CreateService
and pass organization_id
in the new
method. The call to Current.organization_id
(or something else, if feasible) should be on the request-level, ie controller or Grape API. So in some cases, we need to pass the organization_id
through various layers of calls until we reach Groups::CreateService
Remove exception in .rubocop_todo/gitlab/avoid_current_organization.yml
Remove traces of Current.organization
from Groups::CreateService
Code Paths
A simple git grep Groups::CreateService
revealed these files. In order to avoid big MRs, I split them up.
- !149109 (merged) is related to manually creating project (From UI or API)
- !150829 (merged) is related to group/project import logic
Still need to be created:
- The third MR will be related to Subscripts/ GitLab Duo
- The fourth MR is a cleanup MR (remove usage of
Current.organization
from theGroups::CreateService
, remove the rubocop exception.rubocop_todo/gitlab/avoid_current_organization.yml
Code paths in this MR:
- app/controllers/admin/groups_controller.rb MR !149109 (merged)
- app/controllers/groups_controller.rb MR !149109 (merged)
- app/controllers/import/gitlab_groups_controller.rb MR !150829 (merged)
- ee/app/controllers/subscriptions_controller.rb MR !150996 (merged)
-
ee/app/services/gitlab_subscriptions/trials/base_create_service.rb MR !150996 (merged)
- GitlabSubscriptions::Trials::CreateDuoProService
-
ee/app/services/registrations/import_namespace_create_service.rb MR !150996 (merged)
- ee/app/controllers/registrations/groups_controller.rb
-
ee/app/services/registrations/standard_namespace_create_service.rb MR !150996 (merged)
- ee/app/controllers/registrations/groups_controller.rb
- ee/lib/gitlab/duo/developments/setup.rb MR !150996 (merged)
- lib/api/group_import.rb MR !150829 (merged)
- lib/api/groups.rb MR !149109 (merged)
- lib/bulk_imports/groups/loaders/group_loader.rb MR !150829 (merged)
- lib/gitlab/import_export/group/tree_restorer.rb MR !150829 (merged), no change, it is using parent_id
- lib/gitlab/seeders/ci/runner/runner_fleet_seeder.rb No change needed, it is passing parent_id
- lib/tasks/gitlab/seed/group_seed.rake This script is broken #462762
The files marked in bold are done