Skip to content

Commit

Permalink
Allow searching by login ids (#408)
Browse files Browse the repository at this point in the history
related to descope/etc#7585
  • Loading branch information
aviadl authored Sep 5, 2024
1 parent 3bb28bb commit 5ab1199
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions descope/management/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ def search_all(
sso_app_ids: Optional[List[str]] = None,
sort: Optional[List[Sort]] = None,
text: Optional[str] = None,
login_ids: Optional[List[str]] = None,
) -> dict:
"""
Search all users.
Expand All @@ -608,6 +609,7 @@ def search_all(
phones (List[str]): Optional list of phones to search for
sso_app_ids (List[str]): Optional list of SSO application IDs to filter by
text (str): Optional string, allows free text search among all user's attributes.
login_ids (List[str]): Optional list of login ids
sort (List[Sort]): Optional List[dict], allows to sort by fields.
Return value (dict):
Expand Down Expand Up @@ -653,6 +655,9 @@ def search_all(
if sso_app_ids is not None:
body["ssoAppIds"] = sso_app_ids

if login_ids is not None:
body["loginIds"] = login_ids

if text is not None:
body["text"] = text

Expand Down
7 changes: 6 additions & 1 deletion tests/management/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,11 @@ def test_search_all(self):
)
mock_post.return_value = network_resp
resp = self.client.mgmt.user.search_all(
["t1, t2"], ["r1", "r2"], with_test_user=True, sso_app_ids=["app1"]
["t1, t2"],
["r1", "r2"],
with_test_user=True,
sso_app_ids=["app1"],
login_ids=["l1"],
)
users = resp["users"]
self.assertEqual(len(users), 2)
Expand All @@ -861,6 +865,7 @@ def test_search_all(self):
"testUsersOnly": False,
"withTestUser": True,
"ssoAppIds": ["app1"],
"loginIds": ["l1"],
},
allow_redirects=False,
verify=True,
Expand Down

0 comments on commit 5ab1199

Please sign in to comment.