Skip to content

Commit 33d0903

Browse files
authored
Allow passing expired user status (#710)
1 parent f56ad0c commit 33d0903

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

descope/management/authz.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def create_relations(
181181
"tenants": ["t1", "t2"],
182182
"roles": ["r1", "r2"],
183183
"text": "full-text-search",
184-
"statuses": ["enabled|disabled|invited"],
184+
"statuses": ["enabled|disabled|invited|expired"],
185185
"ssoOnly": True|False,
186186
"withTestUser": True|False,
187187
"customAttributes": {

descope/management/user.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ def patch(
438438
picture (str): Optional url for user picture
439439
custom_attributes (dict): Optional, set the different custom attributes values of the keys that were previously configured in Descope console app
440440
sso_app_ids (List[str]): Optional, list of SSO applications IDs to be associated with the user.
441-
status (str): Optional status field. Can be one of: "enabled", "disabled", "invited".
441+
status (str): Optional status field. Can be one of: "enabled", "disabled", "invited", "expired".
442442
test (bool, optional): Set to True to update a test user. Defaults to False.
443443
444444
Return value (dict):
@@ -449,11 +449,16 @@ def patch(
449449
Raise:
450450
AuthException: raised if patch operation fails
451451
"""
452-
if status is not None and status not in ["enabled", "disabled", "invited"]:
452+
if status is not None and status not in [
453+
"enabled",
454+
"disabled",
455+
"invited",
456+
"expired",
457+
]:
453458
raise AuthException(
454459
400,
455460
ERROR_TYPE_INVALID_ARGUMENT,
456-
f"Invalid status value: {status}. Must be one of: enabled, disabled, invited",
461+
f"Invalid status value: {status}. Must be one of: enabled, disabled, invited, expired",
457462
)
458463
response = self._http.patch(
459464
MgmtV1.user_patch_path,
@@ -506,11 +511,12 @@ def patch_batch(
506511
"enabled",
507512
"disabled",
508513
"invited",
514+
"expired",
509515
]:
510516
raise AuthException(
511517
400,
512518
ERROR_TYPE_INVALID_ARGUMENT,
513-
f"Invalid status value: {user.status} for user {user.login_id}. Must be one of: enabled, disabled, invited",
519+
f"Invalid status value: {user.status} for user {user.login_id}. Must be one of: enabled, disabled, invited, expired",
514520
)
515521

516522
response = self._http.patch(
@@ -728,7 +734,7 @@ def search_all(
728734
test_users_only (bool): Optional filter only test users.
729735
with_test_user (bool): Optional include test users in search.
730736
custom_attributes (dict): Optional search for a attribute with a given value
731-
statuses (List[str]): Optional list of statuses to search for ("enabled", "disabled", "invited")
737+
statuses (List[str]): Optional list of statuses to search for ("enabled", "disabled", "invited", "expired")
732738
emails (List[str]): Optional list of emails to search for
733739
phones (List[str]): Optional list of phones to search for
734740
sso_app_ids (List[str]): Optional list of SSO application IDs to filter by
@@ -850,7 +856,7 @@ def search_all_test_users(
850856
limit (int): Optional limit of the number of users returned. Leave empty for default.
851857
page (int): Optional pagination control. Pages start at 0 and must be non-negative.
852858
custom_attributes (dict): Optional search for a attribute with a given value
853-
statuses (List[str]): Optional list of statuses to search for ("enabled", "disabled", "invited")
859+
statuses (List[str]): Optional list of statuses to search for ("enabled", "disabled", "invited", "expired")
854860
emails (List[str]): Optional list of emails to search for
855861
phones (List[str]): Optional list of phones to search for
856862
sso_app_ids (List[str]): Optional list of SSO application IDs to filter by

0 commit comments

Comments
 (0)