Skip to content
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,13 @@ $response = $descopeSDK->management->user->searchAll(
['ssoApp123'], // ssoAppIds
[ // sort
['field' => 'displayName', 'desc' => true]
]
],
null, // tenantRoleIds
null, // tenantRoleNames
1700000000000, // fromCreatedTime (Unix epoch milliseconds)
1800000000000, // toCreatedTime (Unix epoch milliseconds)
1700000000000, // fromModifiedTime (Unix epoch milliseconds)
1800000000000 // toModifiedTime (Unix epoch milliseconds)
);
print_r($response);
```
Expand Down
36 changes: 30 additions & 6 deletions src/SDK/Management/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,10 @@ public function loadByUserId(string $userId): array
* @param string|null $text Optional string, allows free text search among all user's attributes.
* @param array|null $tenantRoleIds Optional map of tenants and list of role IDs to filter by.
* @param array|null $tenantRoleNames Optional map of tenants and list of role names to filter by.
* @param int|null $fromCreatedTime Optional, only include users created on or after this time (Unix epoch milliseconds).
* @param int|null $toCreatedTime Optional, only include users created on or before this time (Unix epoch milliseconds).
* @param int|null $fromModifiedTime Optional, only include users modified on or after this time (Unix epoch milliseconds).
* @param int|null $toModifiedTime Optional, only include users modified on or before this time (Unix epoch milliseconds).
* @return array Return dict in the format {"users": []}. "users" contains a list of all of the found users and their information.
* @throws AuthException if search operation fails.
*/
Expand All @@ -567,7 +571,11 @@ public function searchAll(
$ssoAppIds = null,
$sort = null,
$tenantRoleIds = null,
$tenantRoleNames = null
$tenantRoleNames = null,
$fromCreatedTime = null,
$toCreatedTime = null,
$fromModifiedTime = null,
$toModifiedTime = null
) {
// Prepare the request body ensuring PHP 7.x compatibility
$body = [
Expand All @@ -593,13 +601,17 @@ public function searchAll(
}, $sort) : [],
'loginIds' => [],
'tenantRoleIds' => $this->mapToValuesObject($tenantRoleIds),
'tenantRoleNames' => $this->mapToValuesObject($tenantRoleNames)
'tenantRoleNames' => $this->mapToValuesObject($tenantRoleNames),
'fromCreatedTime' => $fromCreatedTime !== null ? (int)$fromCreatedTime : null,
'toCreatedTime' => $toCreatedTime !== null ? (int)$toCreatedTime : null,
'fromModifiedTime' => $fromModifiedTime !== null ? (int)$fromModifiedTime : null,
'toModifiedTime' => $toModifiedTime !== null ? (int)$toModifiedTime : null
];

$body = array_filter($body, function ($value) {
return $value !== null && $value !== '';
});

return $this->api->doPost(
MgmtV1::$USERS_SEARCH_PATH,
$body,
Expand Down Expand Up @@ -1425,6 +1437,10 @@ public function loadUsers(array $userIds, bool $includeInvalidUsers = false): ar
* @param string|null $text Optional free text search.
* @param array|null $tenantRoleIds Optional map of tenants and list of role IDs.
* @param array|null $tenantRoleNames Optional map of tenants and list of role names.
* @param int|null $fromCreatedTime Optional, only include users created on or after this time (Unix epoch milliseconds).
* @param int|null $toCreatedTime Optional, only include users created on or before this time (Unix epoch milliseconds).
* @param int|null $fromModifiedTime Optional, only include users modified on or after this time (Unix epoch milliseconds).
* @param int|null $toModifiedTime Optional, only include users modified on or before this time (Unix epoch milliseconds).
* @return array Return dict in the format {"users": []}.
* @throws AuthException
*/
Expand All @@ -1442,7 +1458,11 @@ public function searchAllTestUsers(
$ssoAppIds = null,
$sort = null,
$tenantRoleIds = null,
$tenantRoleNames = null
$tenantRoleNames = null,
$fromCreatedTime = null,
$toCreatedTime = null,
$fromModifiedTime = null,
$toModifiedTime = null
): array {
$body = [
'loginId' => $loginId ?? '',
Expand All @@ -1466,7 +1486,11 @@ public function searchAllTestUsers(
}, $sort) : [],
'loginIds' => [],
'tenantRoleIds' => $this->mapToValuesObject($tenantRoleIds),
'tenantRoleNames' => $this->mapToValuesObject($tenantRoleNames)
'tenantRoleNames' => $this->mapToValuesObject($tenantRoleNames),
'fromCreatedTime' => $fromCreatedTime !== null ? (int)$fromCreatedTime : null,
'toCreatedTime' => $toCreatedTime !== null ? (int)$toCreatedTime : null,
'fromModifiedTime' => $fromModifiedTime !== null ? (int)$fromModifiedTime : null,
'toModifiedTime' => $toModifiedTime !== null ? (int)$toModifiedTime : null
];

$body = array_filter($body, function ($value) {
Expand Down