Skip to content

Commit

Permalink
Add unenrolled user lockout setting to adminapi (#249)
Browse files Browse the repository at this point in the history
  • Loading branch information
juangw authored Jan 30, 2024
1 parent e0324f4 commit 0d3b5ec
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions duo_client/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
'user_managers_can_put_users_in_bypass': <bool:can user managers put users in bypass status>,
'email_activity_notification_enabled': <bool:can users get activity notifications via email>,
'push_activity_notification_enabled': <bool:can users get activity notifications via Duo Mobile>,
'unenrolled_user_lockout_threshold': <int:days until a user will be locked out due to being unenrolled>,
}
Expand Down Expand Up @@ -1985,6 +1986,7 @@ def update_settings(self,
user_managers_can_put_users_in_bypass=None,
email_activity_notification_enabled=None,
push_activity_notification_enabled=None,
unenrolled_user_lockout_threshold=None,
):
"""
Update settings.
Expand Down Expand Up @@ -2026,6 +2028,7 @@ def update_settings(self,
user_managers_can_put_users_in_bypass - True|False|None
email_activity_notification_enabled = True|False|None
push_activity_notification_enabled = True|False|None
unenrolled_user_lockout_threshold = <int:number of days>|0|None
Returns updated settings object.
Expand Down Expand Up @@ -2109,6 +2112,10 @@ def update_settings(self,
params['push_activity_notification_enabled'] = (
'1' if push_activity_notification_enabled else '0'
)
if unenrolled_user_lockout_threshold is not None:
params['unenrolled_user_lockout_threshold'] = str(
unenrolled_user_lockout_threshold
)

if not params:
raise TypeError("No settings were provided")
Expand Down
8 changes: 7 additions & 1 deletion tests/admin/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ def test_update_settings(self):
reactivation_url="https://www.example.com",
reactivation_integration_key='DINTEGRATIONKEYTEST0',
security_checkup_enabled=True,
user_managers_can_put_users_in_bypass=False
user_managers_can_put_users_in_bypass=False,
email_activity_notification_enabled=True,
push_activity_notification_enabled=True,
unenrolled_user_lockout_threshold=100,
)
response = response[0]
self.assertEqual(response['method'], 'POST')
Expand Down Expand Up @@ -79,4 +82,7 @@ def test_update_settings(self):
'reactivation_integration_key': 'DINTEGRATIONKEYTEST0',
'security_checkup_enabled': '1',
'user_managers_can_put_users_in_bypass': '0',
'email_activity_notification_enabled': '1',
'push_activity_notification_enabled': '1',
'unenrolled_user_lockout_threshold': '100',
})

0 comments on commit 0d3b5ec

Please sign in to comment.