Add completed source users field to current user GraphQL type

What does this MR do and why?

This MR adds a currentUser.importSourceUsers GraphQL field to return a user's completed source user mappings, gated behind a WIP feature flag revoke_import_source_user_reassignment. The new field allows the user to see what users on source instances they have allowed imported contributions to be assigned to, i.e. their revokable source user mappings. This MR introduces a new policy, read_import_source_user, enabled for namespace owners and the real reassigned user on a source user.

This MR does not include the mutation to actually revoke these mappings, that's in a separate MR: !258268 (merged)

References

Screenshots or screen recordings

N/A

How to set up and validate locally

  1. Enable the feature flag: Feature.enable(:revoke_import_source_user_reassignment)
  2. Ensure there's completed source users reassigned to your user. If you don't have any source users, import a project with contributions from one of the supported sources and reassign a user's contributions: https://docs.gitlab.com/user/import/mapping/post_migration_mapping
  3. Query importSourceUsers with the reassigned user as currentUser and verify source user information is returned:
query {
  currentUser {
    importSourceUsers {
      nodes {
        id
        sourceName
        status
      }
    }
  }
}

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.

Edited by Sam Word

Merge request reports

Loading
Loading