-
Notifications
You must be signed in to change notification settings - Fork 17
Adds multiple roles support to OrganizationMembership Create and Update #302
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
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.
Greptile Summary
This PR implements support for multiple roles in WorkOS organization memberships, extending the existing single-role functionality while maintaining backward compatibility. The changes span three main areas:
Resource Enhancement: The OrganizationMembership resource now includes a new roles property (array of RoleResponse objects) alongside the existing role property. This allows the resource to handle both single-role and multi-role scenarios in API responses.
API Method Updates: Both createOrganizationMembership and updateOrganizationMembership methods in the UserManagement class now accept an optional roleSlugs parameter in addition to the existing roleSlug parameter. The API sends both parameters to the server, allowing the backend to determine which one to use based on the organization's configuration.
Test Coverage: Comprehensive test coverage has been added to verify both backward compatibility with existing single-role functionality and proper operation of the new multiple-role features. Test fixtures have been updated to include the new roles array in API response mocks.
The implementation follows an additive approach that preserves existing functionality while enabling new capabilities. Organizations can now assign multiple roles to users within their memberships, providing more granular access control. The changes integrate well with the existing WorkOS PHP SDK architecture, using the same resource mapping patterns and API request handling mechanisms already established in the codebase.
A minor .gitignore update was also included to exclude JetBrains IDE configuration files from version control.
Confidence score: 5/5
- This PR is safe to merge with minimal risk
- Score reflects well-structured backward-compatible changes with comprehensive test coverage
- No files require special attention
4 files reviewed, no comments
mattgd
left a comment
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.
Left a few comments regarding tests, but otherwise looks good.
Description
rolesto organization membership resource responses (get, list, create, update, deactivate, reactivate)roleSlugsparameter to organization membership create and update optionsDocumentation
Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.
Will update the docs for these changes in ENT-3687
Testing
Tested locally against a team with multiple roles enabled. I tested OM get and update.