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 detailsbutton 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,revokebuttons don't do anything at the moment. Will be added in a follow-up, #583546
References
Screenshots or screen recordings
| Legacy Token | Granular Token |
|---|---|
|
|
How to set up and validate locally
- 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)
- Navigate to
Preferences > Personal access tokens. You should see the current personal access tokens table - Enable the feature flag
granular_personal_access_tokensand 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

