Add api scope validations

What does this MR do and why?

This change addresses #375057 (closed).

In addition to adding a scope check for the access token in the UI when initiating a bulk import/gitlab migration, this MR ensures we validate token's scope on the service level as well, in the event that the user bypasses the UI.

This implementation uses the .../api/v4/personal_access_tokens/self endpoint to retrieve information about the access token provided and validate the presence of an api scope.

If successful the service is created. If not, a connection error is raised and rescued as a service error.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #375057 (closed)

Merge request reports

Loading