Draft: Secrets Manager: Gate UI actions on granular permissions (frontend only)
What does this MR do and why?
Splits the frontend changes from !240596 (merged) into a separate MR, as requested by @mgandres. The backend MR (!240596 (merged)) should be merged first to ensure the userPermissions GraphQL fields are available before the frontend code is deployed.
This MR gates Secrets Manager UI actions on granular permissions fetched from the userPermissions field on the secrets manager status query. isReadOnly takes precedence over all permission checks (archived/marked-for-deletion projects still hide all actions).
Changes
GraphQL queries:
- Update
getGroupSecretManagerStatusandgetProjectSecretManagerStatusto includeuserPermissionsfields
SecretsApp:
- Propagate
canCreateSecret,canUpdateSecret,canDeleteSecretvia Vueprovide(defaults totruefor backward compatibility with old backend responses) - Read
userPermissionsfrom the status query response and update the provided values
SecretsTable:
- Gate New secret button (empty state + table header) on
canCreateSecret - Gate actions column on
canUpdateSecret || canDeleteSecret - Pass
canUpdate/canDeleteprops toSecretActionsCell
SecretActionsCell:
- Add
canUpdateandcanDeleteprops (defaulttrue) - Conditionally render Edit and Delete items based on props
SecretDetailsWrapper:
- Inject
canUpdateSecretandcanDeleteSecret - Gate Edit button on
canUpdateSecret(and!isReadOnly) - Gate Delete dropdown on
canDeleteSecret(and!isReadOnly)
SecretFormWrapper + SecretForm:
- Inject
canCreateSecretandcanUpdateSecretin wrapper - Compute
isPermissionDeniedbased onisEditingand the relevant permission - Pass
isPermissionDeniedtoSecretForm - Show non-dismissable danger alert when
isPermissionDenied - Disable all form fields and submit button when
isPermissionDenied
Tests:
- Add/update Jest specs for all changed components covering all permission combinations and
isReadOnlyoverride behavior
References
- Issue: #601817
- Backend MR (to be merged first): !240596 (merged)
Screenshots or screen recordings
| Before | After |
|---|---|
| New Secret button and Edit/Delete actions visible to all users with Reporter+ role | New Secret button and Edit/Delete actions hidden from users without the corresponding granular Secrets Manager permission; form fields disabled with alert when lacking create/update permission |
How to set up and validate locally
- Enable the secrets manager for a project/group.
- Log in as a user with Reporter role (no granular secrets permission granted).
- Visit the Secrets Manager page — the New Secret button and action dropdown should be hidden.
- Grant the user a granular create/update/delete permission via the Secrets Manager permissions UI.
- Verify the corresponding UI elements appear.
- Visit the
/newform without create permission — form fields should be disabled with a warning alert. - Visit the
/editform without update permission — form fields should be disabled with a warning alert.
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.