From 0d3b5eccebd927351ceb8ddb94bf3dd61da7fb5a Mon Sep 17 00:00:00 2001 From: William Juang Date: Tue, 30 Jan 2024 09:44:48 -0600 Subject: [PATCH] Add unenrolled user lockout setting to adminapi (#249) --- duo_client/admin.py | 7 +++++++ tests/admin/test_settings.py | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/duo_client/admin.py b/duo_client/admin.py index d01163e..490e14b 100644 --- a/duo_client/admin.py +++ b/duo_client/admin.py @@ -114,6 +114,7 @@ 'user_managers_can_put_users_in_bypass': , 'email_activity_notification_enabled': , 'push_activity_notification_enabled': , + 'unenrolled_user_lockout_threshold': , } @@ -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. @@ -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 = |0|None Returns updated settings object. @@ -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") diff --git a/tests/admin/test_settings.py b/tests/admin/test_settings.py index b92ffb1..908fec5 100644 --- a/tests/admin/test_settings.py +++ b/tests/admin/test_settings.py @@ -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') @@ -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', })