Hide virtual registry scopes from project deploy tokens UI
Problem to solve
In MR !185059 (merged), we added UI changes to display the new virtual registry scopes (read_virtual_registry and write_virtual_registry) in the UI for creating deploy tokens when the dependency proxy is enabled. However, these scopes should not be visible in the UI for creating project deploy tokens, only for group deploy tokens.
Dependency Proxy and Virtual Registry are resources at the group level, so it does not make sense to grant permissions to them at the project level.
Proposal
We need to modify the deploy token creation UI to hide the virtual registry scopes specifically when creating project deploy tokens, while keeping them visible for group deploy tokens.
Implementation details
-
Update the
new_deploy_token.vuecomponent to check the token type (project vs group) before displaying the virtual registry scopes -
Modify the condition that determines when to show the virtual registry scopes:
{ id: 'deploy_token_read_virtual_registry', isShown: this.$props.dependencyProxyEnabled && this.$props.tokenType !== 'project', value: false, helpText: this.$options.translations.readVirtualRegistryHelp, scopeName: 'read_virtual_registry', }, { id: 'deploy_token_write_virtual_registry', isShown: this.$props.dependencyProxyEnabled && this.$props.tokenType !== 'project', value: false, helpText: this.$options.translations.writeVirtualRegistryHelp, scopeName: 'write_virtual_registry', }, -
Update the relevant tests to verify that:
- Virtual registry scopes are not shown for project deploy tokens
- Virtual registry scopes are shown for group deploy tokens when dependency proxy is enabled
Validation steps
- Navigate to a project's settings > Repository > Deploy Tokens
- Create a new deploy token
- Verify that the "Read virtual registry" and "Write virtual registry" scopes are not visible
- Navigate to a group's settings > Repository > Deploy Tokens
- Create a new deploy token
- Verify that the "Read virtual registry" and "Write virtual registry" scopes are visible (if dependency proxy is enabled)
Related links
- Related to MR !185059 (merged) "UI and documentation changes for the virtual registry scopes"
- Related to #336800 (closed)