Skip to content
Merged
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
20 changes: 20 additions & 0 deletions lib/Resource/DirectoryUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,25 @@ class DirectoryUser extends BaseWorkOSResource
"rawAttributes",
"customAttributes",
"firstName",
"email",
/**
* [Deprecated] Will be removed in a future major version.
* Enable the `emails` custom attribute in dashboard and pull from customAttributes instead.
* See https://workos.com/docs/directory-sync/attributes/custom-attributes/auto-mapped-attributes for details.
*/
"emails",
/**
* [Deprecated] Will be removed in a future major version.
* Enable the `username` custom attribute in dashboard and pull from customAttributes instead.
* See https://workos.com/docs/directory-sync/attributes/custom-attributes/auto-mapped-attributes for details.
*/
"username",
"lastName",
/**
* [Deprecated] Will be removed in a future major version.
* Enable the `job_title` custom attribute in dashboard and pull from customAttributes instead.
* See https://workos.com/docs/directory-sync/attributes/custom-attributes/auto-mapped-attributes for details.
*/
"jobTitle",
"state",
"idpId",
Expand All @@ -30,6 +46,7 @@ class DirectoryUser extends BaseWorkOSResource
"raw_attributes" => "rawAttributes",
"custom_attributes" => "customAttributes",
"first_name" => "firstName",
"email" => "email",
"emails" => "emails",
"username" => "username",
"last_name" => "lastName",
Expand All @@ -41,6 +58,9 @@ class DirectoryUser extends BaseWorkOSResource
"organization_id" => "organizationId"
];

/**
* [Deprecated] Use `email` instead.
*/
public function primaryEmail()
{
$response = $this;
Expand Down
4 changes: 4 additions & 0 deletions tests/WorkOS/DirectorySyncTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ private function usersResponseFixture()
"organization_id" => "org_123",
"idp_id" => null,
"groups" => null,
"email" => "yoon@seri.com",
"emails" => [
[
"primary" => true,
Expand Down Expand Up @@ -407,6 +408,7 @@ private function userResponseFixture()
"organization_id" => "org_123",
"idp_id" => null,
"groups" => null,
"email" => "yoon@seri.com",
"emails" => [
[
"primary" => true,
Expand Down Expand Up @@ -460,6 +462,7 @@ private function userResponseFixtureNoEmail()
"organization_id" => "org_123",
"idp_id" => null,
"groups" => null,
"email" => null,
"emails" => [],
"raw_attributes" => [
"schemas" => ["urn:scim:schemas:core:1.0"],
Expand Down Expand Up @@ -530,6 +533,7 @@ private function userFixture()
"fullName" => "Yoon Seri"
],
"firstName" => "Yoon",
"email" => "yoon@seri.com",
"emails" => [
[
"primary" => true,
Expand Down