Skip to content

feat: Add RBAC environment roles API support#338

Merged
gjtorikian merged 8 commits intomainfrom
feature/ent-4805-workos-php-environment-roles
Mar 6, 2026
Merged

feat: Add RBAC environment roles API support#338
gjtorikian merged 8 commits intomainfrom
feature/ent-4805-workos-php-environment-roles

Conversation

@csrbarber
Copy link
Contributor

Summary

  • Add resource_type_slug field to Role resource
  • Add environment role endpoints to RBAC module: createEnvironmentRole, listEnvironmentRoles, getEnvironmentRole, updateEnvironmentRole, setEnvironmentRolePermissions, addEnvironmentRolePermission
  • Update OrganizationsTest role fixtures to include resource_type_slug

Part 2 of 3 for RBAC support. Stacked on #337.

Test plan

  • 6 new tests covering each environment role endpoint
  • All existing tests pass (including updated Organization role fixtures)

🤖 Generated with Claude Code

@csrbarber csrbarber requested review from a team as code owners March 6, 2026 21:05
@csrbarber csrbarber requested review from mthadley and removed request for a team March 6, 2026 21:05
@linear
Copy link

linear bot commented Mar 6, 2026

ENT-4805 workos-php

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 6, 2026

Greptile Summary

This PR adds RBAC environment role API support to the WorkOS PHP SDK with six new methods on the RBAC class (createEnvironmentRole, listEnvironmentRoles, getEnvironmentRole, updateEnvironmentRole, setEnvironmentRolePermissions, addEnvironmentRolePermission) and a new resource_type_slug field on the Role resource. It is the second part of a three-part RBAC implementation.

The implementation follows existing patterns, all six methods are covered by tests, and the changes are straightforward and correct.

Confidence Score: 5/5

  • Safe to merge with high confidence. Implementation is correct and well-tested.
  • All code changes are straightforward, follow established patterns in the codebase, and are covered by comprehensive tests. The new methods align with the existing API and resource structure. No security, functionality, or consistency issues identified.
  • No files require special attention

Important Files Changed

Filename Overview
lib/RBAC.php Adds 6 environment role API methods with correct implementation following existing patterns established by permission endpoints. All methods are straightforward implementations without issues.
lib/Resource/Role.php Correctly adds resource_type_slug to the allowed attributes and response mapping. Straightforward and consistent with the existing resource pattern.
tests/WorkOS/RBACTest.php 6 new tests comprehensively cover all added endpoints. Fixtures are properly structured and tests correctly verify the expected behavior.
tests/WorkOS/OrganizationsTest.php Updated role fixtures to include the new resource_type_slug field. Changes are minimal and correct.

Last reviewed commit: 9c0f184

@csrbarber csrbarber force-pushed the feature/ent-4805-workos-php-environment-roles branch from 9c0f184 to 22a8ef5 Compare March 6, 2026 21:32
Base automatically changed from feature/ent-4805-workos-php-permissions to main March 6, 2026 21:40
@csrbarber csrbarber force-pushed the feature/ent-4805-workos-php-environment-roles branch from eb3d554 to 5076e17 Compare March 6, 2026 21:46
csrbarber and others added 4 commits March 6, 2026 17:48
Add environment role CRUD endpoints plus set/add permissions to the RBAC
module. Also adds resource_type_slug field to Role resource.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@csrbarber csrbarber force-pushed the feature/ent-4805-workos-php-environment-roles branch from 5076e17 to 47a73b7 Compare March 6, 2026 21:49
gjtorikian and others added 4 commits March 6, 2026 16:51
Migrate listPermissions and listEnvironmentRoles to use
PaginatedResource from #316. Also adds pagination params to
listEnvironmentRoles and restores type hint on getPermission.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Add string type hints to all RBAC role method parameters for
consistency with existing permission methods. Add deleteOrganizationRole
endpoint per WorkOS API docs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gjtorikian gjtorikian merged commit 31fb41d into main Mar 6, 2026
8 checks passed
@gjtorikian gjtorikian deleted the feature/ent-4805-workos-php-environment-roles branch March 6, 2026 22:09
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.

2 participants