-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delete builtin_roles
#7477
base: main
Are you sure you want to change the base?
Delete builtin_roles
#7477
Conversation
459eb1a
to
abf3eef
Compare
I'll probably want to update this comment too. If the premise of this PR is correct, the comment was wrong to say the omicron/nexus/auth/src/authz/mod.rs Lines 68 to 115 in ca58574
|
* If the set of roles and their permissions are fixed, why store them in the | ||
* database at all? Because what's dynamic is the assignment of roles to users. | ||
* We have a separate table that says "user U has role ROLE on resource | ||
* RESOURCE". How do we represent the ROLE part of this association? We use a | ||
* foreign key into this "role_builtin" table. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a strong feeling either way on the PR overall but this note got me thinking: is there value in having this? It'd probably be better if we actually enforced that the (resource_type
, role_name
) column in role_assignment
were a valid foreign key. Given how static this is today, these could as well be enum values instead. 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think converting role to an enum would make a lot of sense.
This came up in a meeting with @davepacheco — storing the roles in the DB and letting them be listed through the API is a legacy idea with no practical application that we know of. When I heard that I was curious how much could be deleted.
Fundamentally, all this machinery I've deleted was just in service of the
role_view
androle_list
endpoints, which let you get something like this list:I think we thought this would be a dynamic list of roles, but all these things are hard-coded. As far as I can tell there is no relationship to the actual authorization system — this is basically just an unrelated copy of that stuff. This claim will (hopefully) borne out by the fact that deleting all this stuff doesn't affect anything else.