-
Notifications
You must be signed in to change notification settings - Fork 17
Add roles to directory user and SSO profile
#311
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
Conversation
| * | ||
| * @property RoleResponse|null $role | ||
| * @property array<RoleResponse>|null $roles |
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.
The other properties need to be added here but didn't want to conflate this PR.
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
|
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.
6 files reviewed, no comments
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.