Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .last-synced-sha
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a10d9ecb766d2dd996aecb19aa9c801d78bb7c26
13aaa9a125fc87d1ed23acd5ef740382510296be
2 changes: 1 addition & 1 deletion .oagen-manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": 2,
"language": "php",
"generatedAt": "2026-05-06T22:17:34.176Z",
"generatedAt": "2026-05-18T17:54:50.669Z",
"files": [
"lib/Resource/ActionAuthenticationDenied.php",
"lib/Resource/ActionAuthenticationDeniedData.php",
Expand Down
18 changes: 15 additions & 3 deletions lib/Service/Authorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ public function listEffectivePermissionsByExternalId(
* @param string|null $after An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`.
* @param int|null $limit Upper limit on the number of objects to return, between `1` and `100`. Defaults to 10.
* @param \WorkOS\Resource\PaginationOrder $order Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. Defaults to "desc".
* @param string|null $resourceId Filter assignments by the ID of the resource.
* @param string|null $resourceExternalId Filter assignments by the external ID of the resource.
* @param string|null $resourceTypeSlug Filter assignments by the slug of the resource type.
* @return \WorkOS\PaginatedResponse<\WorkOS\Resource\UserRoleAssignment>
* @throws \WorkOS\Exception\WorkOSException
*/
Expand All @@ -198,13 +201,19 @@ public function listRoleAssignments(
?string $after = null,
?int $limit = null,
\WorkOS\Resource\PaginationOrder $order = \WorkOS\Resource\PaginationOrder::Desc,
?string $resourceId = null,
?string $resourceExternalId = null,
?string $resourceTypeSlug = null,
?\WorkOS\RequestOptions $options = null,
): \WorkOS\PaginatedResponse {
$query = array_filter([
'before' => $before,
'after' => $after,
'limit' => $limit,
'order' => $order->value,
'resource_id' => $resourceId,
'resource_external_id' => $resourceExternalId,
'resource_type_slug' => $resourceTypeSlug,
], fn ($v) => $v !== null);
return $this->client->requestPage(
method: 'GET',
Expand Down Expand Up @@ -661,6 +670,7 @@ public function listMembershipsForResourceByExternalId(
* @param string|null $after An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`.
* @param int|null $limit Upper limit on the number of objects to return, between `1` and `100`. Defaults to 10.
* @param \WorkOS\Resource\PaginationOrder $order Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. Defaults to "desc".
* @param string|null $roleSlug Filter assignments by the slug of the role.
* @return \WorkOS\PaginatedResponse<\WorkOS\Resource\UserRoleAssignment>
* @throws \WorkOS\Exception\WorkOSException
*/
Expand All @@ -672,13 +682,15 @@ public function listRoleAssignmentsForResourceByExternalId(
?string $after = null,
?int $limit = null,
\WorkOS\Resource\PaginationOrder $order = \WorkOS\Resource\PaginationOrder::Desc,
?string $roleSlug = null,
?\WorkOS\RequestOptions $options = null,
): \WorkOS\PaginatedResponse {
$query = array_filter([
'before' => $before,
'after' => $after,
'limit' => $limit,
'order' => $order->value,
'role_slug' => $roleSlug,
], fn ($v) => $v !== null);
return $this->client->requestPage(
method: 'GET',
Expand All @@ -701,7 +713,6 @@ public function listRoleAssignmentsForResourceByExternalId(
* @param string|null $organizationId Filter resources by organization ID.
* @param string|null $resourceTypeSlug Filter resources by resource type slug.
* @param string|null $resourceExternalId Filter resources by external ID.
* @param string|null $search Search resources by name.
* @return \WorkOS\PaginatedResponse<\WorkOS\Resource\AuthorizationResource>
* @throws \WorkOS\Exception\WorkOSException
*/
Expand All @@ -714,7 +725,6 @@ public function listResources(
?string $organizationId = null,
?string $resourceTypeSlug = null,
?string $resourceExternalId = null,
?string $search = null,
?\WorkOS\RequestOptions $options = null,
): \WorkOS\PaginatedResponse {
$query = array_filter([
Expand All @@ -725,7 +735,6 @@ public function listResources(
'organization_id' => $organizationId,
'resource_type_slug' => $resourceTypeSlug,
'resource_external_id' => $resourceExternalId,
'search' => $search,
], fn ($v) => $v !== null);
if ($parent instanceof ParentById) {
$query['parent_resource_id'] = $parent->resourceId;
Expand Down Expand Up @@ -918,6 +927,7 @@ public function listMembershipsForResource(
* @param string|null $after An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with `"obj_123"`, your subsequent call can include `after="obj_123"` to fetch a new batch of objects after `"obj_123"`.
* @param int|null $limit Upper limit on the number of objects to return, between `1` and `100`. Defaults to 10.
* @param \WorkOS\Resource\PaginationOrder $order Order the results by the creation time. Supported values are `"asc"` (ascending), `"desc"` (descending), and `"normal"` (descending with reversed cursor semantics where `before` fetches older records and `after` fetches newer records). Defaults to descending. Defaults to "desc".
* @param string|null $roleSlug Filter assignments by the slug of the role.
* @return \WorkOS\PaginatedResponse<\WorkOS\Resource\UserRoleAssignment>
* @throws \WorkOS\Exception\WorkOSException
*/
Expand All @@ -927,13 +937,15 @@ public function listRoleAssignmentsForResource(
?string $after = null,
?int $limit = null,
\WorkOS\Resource\PaginationOrder $order = \WorkOS\Resource\PaginationOrder::Desc,
?string $roleSlug = null,
?\WorkOS\RequestOptions $options = null,
): \WorkOS\PaginatedResponse {
$query = array_filter([
'before' => $before,
'after' => $after,
'limit' => $limit,
'order' => $order->value,
'role_slug' => $roleSlug,
], fn ($v) => $v !== null);
return $this->client->requestPage(
method: 'GET',
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/SSO.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function deleteConnection(
*
* You can persist the WorkOS organization ID with application user or team identifiers. WorkOS will use the organization ID to determine the appropriate connection and the IdP to direct the user to for authentication.
* @param string|null $domainHint Can be used to pre-fill the domain field when initiating authentication with Microsoft OAuth or with a Google SAML connection type.
* @param string|null $loginHint Can be used to pre-fill the username/email address field of the IdP sign-in page for the user, if you know their username ahead of time. Currently supported for OAuth, OpenID Connect, Okta, and Entra ID connections.
* @param string|null $loginHint Can be used to pre-fill the username/email address field of the IdP sign-in page for the user, if you know their username ahead of time. Currently supported for OAuth, OpenID Connect, Okta, Entra ID, and custom SAML connections.
* @param string|null $nonce A random string generated by the client that is used to mitigate replay attacks.
* @return string
* @throws \WorkOS\Exception\ConfigurationException
Expand Down
14 changes: 9 additions & 5 deletions tests/Service/AuthorizationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function testListRoleAssignments(): void
{
$fixture = $this->loadFixture('list_user_role_assignment');
$client = $this->createMockClient([['status' => 200, 'body' => $fixture]]);
$result = $client->authorization()->listRoleAssignments('test_organization_membership_id', before: 'test_value', after: 'test_value', limit: 1, order: \WorkOS\Resource\PaginationOrder::Normal);
$result = $client->authorization()->listRoleAssignments('test_organization_membership_id', before: 'test_value', after: 'test_value', limit: 1, order: \WorkOS\Resource\PaginationOrder::Normal, resourceId: 'test_value', resourceExternalId: 'test_value', resourceTypeSlug: 'test_value');
$this->assertInstanceOf(\WorkOS\PaginatedResponse::class, $result);
$request = $this->getLastRequest();
$this->assertSame('GET', $request->getMethod());
Expand All @@ -91,6 +91,9 @@ public function testListRoleAssignments(): void
$this->assertSame('test_value', $query['after']);
$this->assertArrayHasKey('limit', $query);
$this->assertSame('normal', $query['order']);
$this->assertSame('test_value', $query['resource_id']);
$this->assertSame('test_value', $query['resource_external_id']);
$this->assertSame('test_value', $query['resource_type_slug']);
}

public function testAssignRole(): void
Expand Down Expand Up @@ -290,7 +293,7 @@ public function testListRoleAssignmentsForResourceByExternalId(): void
{
$fixture = $this->loadFixture('list_user_role_assignment');
$client = $this->createMockClient([['status' => 200, 'body' => $fixture]]);
$result = $client->authorization()->listRoleAssignmentsForResourceByExternalId('test_organization_id', 'test_resource_type_slug', 'test_external_id', before: 'test_value', after: 'test_value', limit: 1, order: \WorkOS\Resource\PaginationOrder::Normal);
$result = $client->authorization()->listRoleAssignmentsForResourceByExternalId('test_organization_id', 'test_resource_type_slug', 'test_external_id', before: 'test_value', after: 'test_value', limit: 1, order: \WorkOS\Resource\PaginationOrder::Normal, roleSlug: 'test_value');
$this->assertInstanceOf(\WorkOS\PaginatedResponse::class, $result);
$request = $this->getLastRequest();
$this->assertSame('GET', $request->getMethod());
Expand All @@ -300,13 +303,14 @@ public function testListRoleAssignmentsForResourceByExternalId(): void
$this->assertSame('test_value', $query['after']);
$this->assertArrayHasKey('limit', $query);
$this->assertSame('normal', $query['order']);
$this->assertSame('test_value', $query['role_slug']);
}

public function testListResources(): void
{
$fixture = $this->loadFixture('list_authorization_resource');
$client = $this->createMockClient([['status' => 200, 'body' => $fixture]]);
$result = $client->authorization()->listResources(parent: new \WorkOS\Service\ParentById(resourceId: 'test_value'), before: 'test_value', after: 'test_value', limit: 1, order: \WorkOS\Resource\PaginationOrder::Normal, organizationId: 'test_value', resourceTypeSlug: 'test_value', resourceExternalId: 'test_value', search: 'test_value');
$result = $client->authorization()->listResources(parent: new \WorkOS\Service\ParentById(resourceId: 'test_value'), before: 'test_value', after: 'test_value', limit: 1, order: \WorkOS\Resource\PaginationOrder::Normal, organizationId: 'test_value', resourceTypeSlug: 'test_value', resourceExternalId: 'test_value');
$this->assertInstanceOf(\WorkOS\PaginatedResponse::class, $result);
$request = $this->getLastRequest();
$this->assertSame('GET', $request->getMethod());
Expand All @@ -320,7 +324,6 @@ public function testListResources(): void
$this->assertSame('test_value', $query['organization_id']);
$this->assertSame('test_value', $query['resource_type_slug']);
$this->assertSame('test_value', $query['resource_external_id']);
$this->assertSame('test_value', $query['search']);
}

public function testCreateResource(): void
Expand Down Expand Up @@ -401,7 +404,7 @@ public function testListRoleAssignmentsForResource(): void
{
$fixture = $this->loadFixture('list_user_role_assignment');
$client = $this->createMockClient([['status' => 200, 'body' => $fixture]]);
$result = $client->authorization()->listRoleAssignmentsForResource('test_resource_id', before: 'test_value', after: 'test_value', limit: 1, order: \WorkOS\Resource\PaginationOrder::Normal);
$result = $client->authorization()->listRoleAssignmentsForResource('test_resource_id', before: 'test_value', after: 'test_value', limit: 1, order: \WorkOS\Resource\PaginationOrder::Normal, roleSlug: 'test_value');
$this->assertInstanceOf(\WorkOS\PaginatedResponse::class, $result);
$request = $this->getLastRequest();
$this->assertSame('GET', $request->getMethod());
Expand All @@ -411,6 +414,7 @@ public function testListRoleAssignmentsForResource(): void
$this->assertSame('test_value', $query['after']);
$this->assertArrayHasKey('limit', $query);
$this->assertSame('normal', $query['order']);
$this->assertSame('test_value', $query['role_slug']);
}

public function testListEnvironmentRoles(): void
Expand Down