Skip to content

Commit

Permalink
Invite template id (#465)
Browse files Browse the repository at this point in the history
+ test
related to descope/etc#8535
  • Loading branch information
aviadl authored Dec 13, 2024
1 parent 4bcb1ef commit 3d7cc11
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions descope/management/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ def invite(
] = None, # send invite via text message, default is according to project settings
additional_login_ids: Optional[List[str]] = None,
sso_app_ids: Optional[List[str]] = None,
template_id: str = "",
) -> dict:
"""
Create a new user and invite them via an email / text message.
Expand Down Expand Up @@ -267,6 +268,7 @@ def invite(
send_sms,
additional_login_ids,
sso_app_ids,
template_id,
),
pswd=self._auth.management_key,
)
Expand Down Expand Up @@ -1652,6 +1654,7 @@ def _compose_create_body(
send_sms: Optional[bool],
additional_login_ids: Optional[List[str]],
sso_app_ids: Optional[List[str]] = None,
template_id: str = "",
) -> dict:
body = User._compose_update_body(
login_id=login_id,
Expand Down Expand Up @@ -1680,6 +1683,8 @@ def _compose_create_body(
body["sendMail"] = send_mail
if send_sms is not None:
body["sendSMS"] = send_sms
if template_id != "":
body["templateId"] = template_id
return body

@staticmethod
Expand Down
2 changes: 2 additions & 0 deletions tests/management/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ def test_invite(self):
invite_url="invite.me",
send_sms=True,
sso_app_ids=["app1", "app2"],
template_id="tid",
)
user = resp["user"]
self.assertEqual(user["id"], "u1")
Expand Down Expand Up @@ -264,6 +265,7 @@ def test_invite(self):
"sendSMS": True,
"additionalLoginIds": None,
"ssoAppIDs": ["app1", "app2"],
"templateId": "tid",
},
allow_redirects=False,
verify=True,
Expand Down

0 comments on commit 3d7cc11

Please sign in to comment.