Expose the glaz role on Artifact Registry role assignments
What does this MR do and why?
artifactRegistryRoleAssignments returns role: null for the Organization Administrator tuple. The owner sync writes that tuple on the organization itself, and role is the ArtifactRegistryRole enum, which only knows the four Artifact Registry roles. An API consumer can't tell the assignee is an organization administrator.
This MR adds an assignedRole field to ArtifactRegistryRoleAssignment. It returns the role key and name from the glaz-roles catalogue (Gitlab::Glaz.roles), so any role on a resource resolves, including organization_admin. It's marked as an experiment for 19.6, like the rest of the query.
role keeps its enum type. The members table and the repository access cards read it as an enum today, so changing its type would break them while frontend and backend are on different versions. Its description now points to assignedRole for platform roles.
The lookup service's roles filter now resolves keys with Gitlab::Glaz.roles directly instead of Authz::ArtifactRegistry::Roles, as suggested in the issue. The resolver argument is still the enum, so the API accepts the same values.
The new type disables Graphql/AuthorizeTypes for the same reason as RoleAssignmentType: IAM authorizes the rows before they reach Rails.
References
- Resolves #631886 (closed)
- Closed earlier attempt: !259985 (closed)
- Frontend that will consume this: #629711 (closed)
Screenshots or screen recordings
Not applicable, no UI change.
How to set up and validate locally
I tested this end to end with GDK Rails on this branch and an iam-data-access binary built from IAM main (922633da).
- Start IAM data-access locally (
make up,make iam-data-access,make run-data-access) and point Rails at it inconfig/gitlab.yml:iam_data_access_service: secret_file: /path/to/file/with/the/dev/service/token grpc: host: localhost port: 5005 secure: false - As a non-admin organization owner, run
Authz::Organizations::GrantOwnerRoleWorker.new.perform(organization.id, owner.id)in the Rails console to write the Organization Administrator tuple. - Query the assignments as that owner:
query { artifactRegistryRoleAssignments(resourceIds: [], first: 50) { nodes { resourceId role assignedRole { key name } assignee { username } } } }
Results:
| Case | role |
assignedRole |
|---|---|---|
Organization Administrator tuple, resourceIds: [] |
null |
{"key":"organization_admin","name":"Organization Administrator"} |
Same tuple, resourceIds: [<organization UUID>] |
null |
{"key":"organization_admin","name":"Organization Administrator"} |
Artifact Viewer tuple, resourceIds: [<resource>] |
ARTIFACT_VIEWER |
{"key":"artifact_viewer","name":"Artifact Viewer"} |
I wrote the Artifact Viewer tuple through UpdateRelationshipsClient directly, because the grant mutation verifies resources against a running Artifact Registry.
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.