oxidecomputer / oxidecomputer/omicron

Make role names an enum in the DB

Open
#8,554 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
572
Forks
97
Avg merge
2d 12h
Merged PRs (30d)
96

Description

Followup to #7477, especially https://github.com/oxidecomputer/omicron/pull/7477#discussion_r1942129596.

Role names are currently represented as free-form strings, but as far as I know the only actual values are admin, collaborator, viewer, or external-authenticator. This was originally expected to be a more flexible system, but we've managed to get a lot out of this basic set of roles. After the cleanup in #7477 made clear we are not using a dynamic list of roles, we have an opportunity to simplify things even further by locking down the set of roles to a Rust enum backed by a Rust enum.

https://github.com/oxidecomputer/omicron/blob/2561a7aac1d763d586b32c33ca8d64080b15c890/schema/crdb/dbinit.sql#L2919-L2922

https://github.com/oxidecomputer/omicron/blob/2561a7aac1d763d586b32c33ca8d64080b15c890/nexus/db-model/src/role_assignment.rs#L56-L65

External API structs

Missing external-authenticator because it is never exposed externally.

https://github.com/oxidecomputer/omicron/blob/2561a7aac1d763d586b32c33ca8d64080b15c890/nexus/types/src/external_api/shared.rs#L104-L110

https://github.com/oxidecomputer/omicron/blob/2561a7aac1d763d586b32c33ca8d64080b15c890/nexus/types/src/external_api/shared.rs#L127-L131

https://github.com/oxidecomputer/omicron/blob/2561a7aac1d763d586b32c33ca8d64080b15c890/nexus/types/src/external_api/shared.rs#L146-L150

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading schema/crdb/dbinit.sql, nexus/db-model/src/role_assignment.rs, and the cited external API structs to trace how role names are represented. Follow existing role references and verify that the database and Rust representations use the four listed values while external API types continue to omit external-authenticator.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sql
Domain
backend-api-design, databases
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.