Add project selector to personal access token form [RUN ALL RSPEC] [RUN AS-IF-FOSS]
📖 What does this MR do?
Related to #22754 (closed). Follow-up MR to !54839 (merged)
Adds a project selector to the personal access tokens form. This project selector will be allow users to scope their personal access tokens to one or more projects.
The backend work is not complete yet so it has no effect when submitting the form. Once the backend is completed in #15666 (closed) this field will be hooked up to the controller.
📋 Summary of changes
- Use the GitLab UI
GlTokenSelector
component paired with theprojects
GraphQL query to list all the projects available to the user.
📈 Future iterations
- Add a "Project(s)" column to the table that lists all active PAT
- Wire up the frontend to the backend once the controller has been updated in #15666 (closed)
- Add a new query to get the selected projects when the component mounts. This will prevent
GlTokenSelector
from being cleared if there are form validation errors. This will be needed because currently the page reloads when submitting the form as opposed to submitting via Ajax. - Update documentation
- Add feature specs
💻 Local testing
- Enable the
personal_access_tokens_scoped_to_projects
feature flag.bin/rails console
Feature.enable(:personal_access_tokens_scoped_to_projects)
- Navigate to
/-/profile/personal_access_tokens
📷 Screenshots
🚦 Does this MR meet the acceptance criteria?
Conformity
- [-] Changelog entry
- Not needed, behind a feature flag
- [-] Documentation (if required)
- Will be added in a future iteration
-
Code review guidelines -
Merge request performance guidelines -
Style guides - [-] Database guides
-
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers - [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
- [-] Label as security and @ mention
@gitlab-com/gl-security/appsec
- Will ask for a security review when the backend is done
- [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
- [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by Peter Hegman