Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@csrbarber
Copy link
Contributor

Description

  • Add roles to organization membership resource responses (get, list, create, update, deactivate, reactivate)
  • Add roleSlugs parameter to organization membership create and update options

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[X] Yes

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.

@csrbarber csrbarber requested a review from a team as a code owner September 22, 2025 19:27
@csrbarber csrbarber requested a review from gcarvelli September 22, 2025 19:27
Copy link
Contributor

@greptile-apps greptile-apps bot left a 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

Edit Code Review Bot Settings | Greptile

Copy link
Contributor

@mattgd mattgd left a 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.

@csrbarber csrbarber requested a review from mattgd September 23, 2025 18:04
@csrbarber csrbarber merged commit 16d2d55 into main Sep 24, 2025
5 checks passed
@csrbarber csrbarber deleted the multiple-roles-support branch September 24, 2025 12:31
@csrbarber csrbarber mentioned this pull request Sep 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants