Geo Backend - Add "selective sync by organization" option

Problem

Geo supports selective synchronization by namespace. We should add the ability for a .com sysadmin to specify a set of organizations to replicate to a secondary site.

Proposal

  1. Create a many-to-many relationship between GeoNode and Organizations::Organization. This requires a new model GeoNodeOrganizationLink. See the GeoNodeNamespaceLink as an example.

  2. Update the GeoNode model to accept the new selective sync type organizations.

  3. Update the replicable models selective_sync_scope method to return none when the organization type is selected. Implementing the query for each data type is a separate issue.

    Example: Project.selective_sync_scope

      override :selective_sync_scope
      def selective_sync_scope(node, **_params)
        return all unless node.selective_sync?
    
        if node.selective_sync_by_namespaces?
          where(arel_table.name => { namespace_id: node.namespaces_for_group_owned_replicables.select(:id) })
        elsif node.selective_sync_by_shards?
          within_shards(node.selective_sync_shards)
        elsif node.selective_sync_by_organizations?
          none
        else
          none
        end
      end
  4. Ensure that everything is behind the geo_selective_sync_by_organizations feature flag.

Next: Geo Frontend - Add "selective sync by organizat... (#570585 - closed)

Edited by Michael Kozono