-
Notifications
You must be signed in to change notification settings - Fork 56
Delete builtin_roles
#7477
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
Conversation
459eb1a
to
abf3eef
Compare
This comment was marked as resolved.
This comment was marked as resolved.
* 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.
abf3eef
to
0f46373
Compare
0f46373
to
ed33ff6
Compare
I've checked this over 10 times and can't see any downside, so I'm going to merge it. Made #8554 as a followup to simplify further by using an enum for the role names. |
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 borne out by the fact that deleting all this stuff doesn't affect anything else, i.e., doesn't cause any tests to fail.