Add group and project access tokens to shared token UI behind feature flag

What does this MR do and why?

Adds the Group and Project access-token settings pages to the shared access-tokens Vue app (#js-shared-access-token-app) that personal access tokens already use, behind the migrate_grats_and_prats (gitlab_com_derisk) feature flag. The legacy pages are retained for the flag-off path. This is one step of the migration tracked in #551094, not all of it.

The shared app now supports resource (group/project) tokens: role and access level (a new role field on the ResourceAccessToken API entity), resource-scoped create/revoke/rotate paths, min/max expiry, and last-used IPs. Both mounts pass initSharedAccessTokenApp({ tokenType }) so each page renders the correct heading and data, and the inactive-tokens section is preserved.

Feature flag migrate_grats_and_prats is default-disabled; rollout issue #551192. Migration started in !192835 (closed).

Known gaps

Both must land before the flag is enabled in #551192:

  • Users who can view but not create tokens (auditors, token creation disabled, premium offer or upgrade card) see no token table yet, and the trial token-limit notice is not shown. Fixed in !263042.
  • Tokens created through the API, which the new page uses, do not record the browser user agent in the audit event: #634396.

References

Related to #551094

Screenshots or screen recordings

Group access tokens

Before After
image image

Project access tokens

Before After
image image

How to set up and validate locally

Flag on (new shared UI):

  1. Enable the flag:
    Feature.enable(:migrate_grats_and_prats)
  2. Visit a group's access tokens page (/groups/<group>/-/settings/access_tokens) and a project's (/<group>/<project>/-/settings/access_tokens).
  3. Confirm the heading ("Group access tokens" / "Project access tokens"), the create form, the table with the role and last-used-IP columns, and the inactive tokens section. Create, rotate, and revoke a token.

Flag off (legacy UI):

  1. Feature.disable(:migrate_grats_and_prats) and reload the same pages; the legacy page still works.

Verification run locally: rubocop, haml-lint, eslint, prettier, jest (Vue 2 + Vue 3), the EE PAT model spec, and the access-tokens helper spec all pass. The group and project :js feature specs pass except where the local Vite dev server 504s on unrelated bundles (monaco-editor, test_utils); CI runs them against precompiled assets.

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 Eduardo Sanz García

Merge request reports

Loading
Loading