Add roles to directory user and SSO profile#311
Merged
kendallstrautman merged 2 commits intomainfrom Dec 3, 2025
Merged
Conversation
Comment on lines
+9
to
+11
| * | ||
| * @property RoleResponse|null $role | ||
| * @property array<RoleResponse>|null $roles |
Contributor
Author
There was a problem hiding this comment.
The other properties need to be added here but didn't want to conflate this PR.
Contributor
Greptile OverviewGreptile SummaryAdded support for multiple roles (
Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant API as WorkOS API
participant SDK as PHP SDK
participant Resource as Resource Classes
participant App as Application Code
Note over API,App: API Response Processing Flow
API->>SDK: Return JSON with role/roles data
Note right of API: {role: {slug: "admin"},<br/>roles: [{slug: "admin"}]}
SDK->>Resource: constructFromResponse(response)
Resource->>Resource: parent::constructFromResponse(response)
Note right of Resource: Sets raw values from response
Resource->>Resource: Check isset(response["role"])
Resource->>Resource: Create new RoleResponse(slug)
Note right of Resource: Converts role array to RoleResponse object
Resource->>Resource: Check isset(response["roles"])
loop For each role in roles array
Resource->>Resource: Create new RoleResponse(slug)
end
Note right of Resource: Converts roles array to RoleResponse[]
Resource->>SDK: Return resource instance
SDK->>App: DirectoryUser/Profile/OrganizationMembership
Note right of App: role and roles are now RoleResponse objects
|
csrbarber
approved these changes
Dec 1, 2025
nicknisi
approved these changes
Dec 2, 2025
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.
Description
This PR adds the
rolesproperty to directory user and SSO profile entities to support multiple roles. It also adjusts the serialization of role and roles on the organization membership to match the RoleResponse.Documentation
Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.
If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.