Add Groundlight.me() for authenticated identity - #468
Open
timmarkhuff wants to merge 9 commits into
Open
Conversation
Expose id, email, username, and customer groups from GET /v1/me so callers can inspect the token's tenant without parsing the raw response. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Avoid colliding with detector-group concepts; callers that need the type can import it from groundlight.identity. Co-authored-by: Cursor <cursoragent@cursor.com>
tomfaulhaber
approved these changes
Jul 31, 2026
| name: str = Field(..., description="Name of the customer group.") | ||
|
|
||
|
|
||
| class Me(BaseModel): # pylint: disable=too-few-public-methods |
Collaborator
There was a problem hiding this comment.
We should be able to get this model for free from the api spec if we model it appropriately in the BE
Contributor
Author
There was a problem hiding this comment.
Done. I opened a separate PR to update the backend.
Replace hand-written identity models with codegen from the updated /v1/me schema, and sync spec/public-api.yaml from zuuul. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Import generated models from model, matching other unit tests. Co-authored-by: Cursor <cursoragent@cursor.com>
Revert accidental full-client regenerate noise and keep only the /v1/me schema and generated Me/CustomerGroup wiring. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
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 PR allows SDK users to discover the group (name and id) of a user. A simple check of user's group without triggering token rotation would look something like:
Summary of Changes
Groundlight.me()returning a smallMemodel (id,email,username,groups) fromGET /v1/me.groupsare customer/org tenants (id+name), not detector groups./mefields (feature flags, etc.) are ignored.whoami()now returnsme().email; CLI picks upmeunder Account.spec/public-api.yamland generated models from the zuuul OpenAPI update.Merge order
Me/CustomerGroupschema).Do not merge the SDK until the zuuul OpenAPI change is on main (or otherwise deployed as the source of the synced YAML).
Test plan
poetry run pytest test/unit/test_user.pygl.me()returns email/groups for a real token