Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unenrolled user lockout setting to adminapi #249

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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',
})
Loading