Add drawer to render granular PAT details

What does this MR do and why?

  • Follows from !213832
  • When a token's name is clicked, or when the View details button is clicked, open a drawer that display's the token's details - especially the access + permissions for granular tokens
  • The drawer supports both legacy and granular tokens
  • The rotate, revoke buttons don't do anything at the moment. Will be added in a follow-up, #583546

References

Screenshots or screen recordings

Legacy Token Granular Token
Screenshot_2025-11-28_at_5.10.11_pm Screenshot_2025-11-28_at_5.06.49_pm

How to set up and validate locally

  1. Generate two tokens using the rails console:
PersonalAccessTokens::CreateService.new(
  current_user: <USER>,
  target_user: <USER>,
  organization_id: <USER>.organization_id,
  params: { expires_at: 1.month.from_now, scopes: ['api'], granular: false, name: 'Legacy token', description: 'This is a legacy token' }
)

granular_token = PersonalAccessTokens::CreateService.new(
  current_user: <USER>,
  target_user: <USER>,
  organization_id: <USER>.organization_id,
  params: { expires_at: 1.month.from_now, scopes: ['granular'], granular: true, name: 'Granular token', description: 'This is a granular token' }
)

project = user.projects.first

project_scope = Authz::GranularScope.new(namespace: project.project_namespace, permissions: [:read_pipeline_schedule], access: "selected_memberships")

Authz::GranularScopeService.new(granular_token).add_granular_scopes(project_scope)
  1. Navigate to Preferences > Personal access tokens. You should see the current personal access tokens table
  2. Enable the feature flag granular_personal_access_tokens and refresh the page (you might have to restart GDK). You should see the new UI for the personal access tokens table.

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.

Related to #580922

Edited by Hinam Mehra

Merge request reports

Loading