Add effective fleet and silo role to /v1/me response#8515
Closed
david-crespo wants to merge 1 commit into
Closed
Conversation
david-crespo
commented
Jul 3, 2025
| "collaborator" => 2, | ||
| "admin" => 3, | ||
| _ => 0, | ||
| } |
Contributor
Author
There was a problem hiding this comment.
this is the worst part
Contributor
Author
There was a problem hiding this comment.
My other random PR #7477 is relevant here, especially the suggestion of representing roles as an enum rather than a string (now that we know roles don't need to be free-form), which would make this a lot less hacky.
4228292 to
ec80f33
Compare
ec80f33 to
1b7b3b9
Compare
Contributor
Author
|
Closing in favor of #8861 |
david-crespo
added a commit
that referenced
this pull request
Aug 20, 2025
Dramatically simpler alternative to #8515. Rather than doing the rigmarole required to get the actual specific role on the fleet and silo, we just do little authz checks to get the specific things we care about. The web console is the only consumer that cares about this endpoint so it feels fine to do it that way.
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 is a weird idea I had a few months ago. I decided to polish it up because we might actually need it now that we have some silo admin-specific operations like #8479 or #8214.
Right now, when the web console wants to know whether a user is a fleet viewer in order to decide whether to show them the fleet-level side of the UI, we try to hit a fleet-viewer only GET endpoint and see if it 200s or not (see console source for that). That is silly but has worked fine for a long time. However, other roles there is no obvious way to do that, plus it gets extra silly if you're hitting 5 different endpoints to figure something out that the API could just tell you.
So here, I add some plumbing that lets us add
to the
/v1/meresponse, which heretofore only includes user ID, user display name, silo ID, and silo name. The plumbing is definitely hacked in, especially the role ordering, but based on my tests, it does seem to work.