Skip to content

Commit 3d7cc11

Browse files
authored
Invite template id (#465)
+ test related to descope/etc#8535
1 parent 4bcb1ef commit 3d7cc11

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

descope/management/user.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ def invite(
229229
] = None, # send invite via text message, default is according to project settings
230230
additional_login_ids: Optional[List[str]] = None,
231231
sso_app_ids: Optional[List[str]] = None,
232+
template_id: str = "",
232233
) -> dict:
233234
"""
234235
Create a new user and invite them via an email / text message.
@@ -267,6 +268,7 @@ def invite(
267268
send_sms,
268269
additional_login_ids,
269270
sso_app_ids,
271+
template_id,
270272
),
271273
pswd=self._auth.management_key,
272274
)
@@ -1652,6 +1654,7 @@ def _compose_create_body(
16521654
send_sms: Optional[bool],
16531655
additional_login_ids: Optional[List[str]],
16541656
sso_app_ids: Optional[List[str]] = None,
1657+
template_id: str = "",
16551658
) -> dict:
16561659
body = User._compose_update_body(
16571660
login_id=login_id,
@@ -1680,6 +1683,8 @@ def _compose_create_body(
16801683
body["sendMail"] = send_mail
16811684
if send_sms is not None:
16821685
body["sendSMS"] = send_sms
1686+
if template_id != "":
1687+
body["templateId"] = template_id
16831688
return body
16841689

16851690
@staticmethod

tests/management/test_user.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ def test_invite(self):
236236
invite_url="invite.me",
237237
send_sms=True,
238238
sso_app_ids=["app1", "app2"],
239+
template_id="tid",
239240
)
240241
user = resp["user"]
241242
self.assertEqual(user["id"], "u1")
@@ -264,6 +265,7 @@ def test_invite(self):
264265
"sendSMS": True,
265266
"additionalLoginIds": None,
266267
"ssoAppIDs": ["app1", "app2"],
268+
"templateId": "tid",
267269
},
268270
allow_redirects=False,
269271
verify=True,

0 commit comments

Comments
 (0)