Delete builtin_roles#7477
Merged
Merged
Conversation
459eb1a to
abf3eef
Compare
This comment was marked as resolved.
This comment was marked as resolved.
davepacheco
reviewed
Feb 5, 2025
Comment on lines
-2669
to
-2893
| * 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. |
Collaborator
There was a problem hiding this comment.
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. 🤷
Contributor
Author
There was a problem hiding this comment.
Yeah, I think converting role to an enum would make a lot of sense.
abf3eef to
0f46373
Compare
0f46373 to
ed33ff6
Compare
Contributor
Author
|
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_viewandrole_listendpoints, 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.