Scope AR role assignment lookup to Artifact Registry roles
What does this MR do and why?
artifactRegistryRoleAssignments returned role: null for the Organization Administrator tuple. Organization owners get that grant on the organization resource itself (written by Authz::Organizations::GrantOwnerRoleWorker). With no resourceIds and no roles, the query read every assignment tuple in the organization, including this one. Its role is not in the ArtifactRegistryRole enum, so role was null.
The first two commits on this MR added ORGANIZATION_ADMIN to the enum and added guards in grant and revoke. In review, Diane pointed out that Organization Administrator belongs to the organization and not to Artifact Registry. Other features that write tuples later would hit the same problem, so a guard per role does not scale.
This MR now fixes the lookup instead:
- Removes the
ORGANIZATION_ADMINenum value and the related changes toAuthz::ArtifactRegistry::Roles,RoleAssignmentTypeand the grant service. LookupRoleAssignmentsServicesends the four AR role IDs as the role filter when norolesare passed. The org admin tuple, and tuples other features write later, no longer come back.- The
rolesargument description now says "Defaults to all Artifact Registry roles." GraphQL docs and introspection are updated. - Keeps the revoke guard that rejects a revocation whose resource is the organization UUID. Revoke deletes by assignee and resource with no role, so without the guard it could delete the synced tuple. This is a stopgap.
Revoke is not yet scoped to AR roles. IAM's key-based delete takes no role, so we need either an IAM change or an extra lookup before the delete. I plan to raise this with IAM and follow up in a separate MR.
Adds one translatable string for the revoke message.
Changelog: fixed
References
- Resolves #631886 (closed)
- Related: #629711 (closed)
How to set up and validate locally
bundle exec rspec \
ee/spec/services/authz/artifact_registry/lookup_role_assignments_service_spec.rb \
ee/spec/services/authz/artifact_registry/revoke_role_assignments_service_spec.rbMR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
- I have evaluated the MR acceptance checklist for this MR.