Skip to content

Commit

Permalink
refactor lock and unlock APIs to setting function
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonChen666 committed Oct 10, 2023
1 parent 6dac1f6 commit 36585ab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions synadm/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,11 +672,11 @@ def user_reactivate(self, user_id, password=None):
# TODO: handling errors when password is required?
pass

def user_lock(self, user_id):
return self._user_modify_api(user_id, {"locked": True})

def user_unlock(self, user_id):
return self._user_modify_api(user_id, {"locked": False})
def user_set_lock(self, user_id, locked):
"""
Lock or unlock an account.
"""
return self._user_modify_api(user_id, {"locked": locked})

def user_set_admin(self, user_id, admin):
return self._user_modify_api(user_id, {"admin": admin})
Expand Down
4 changes: 2 additions & 2 deletions synadm/cli/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ def lock(helper, user_id):
Lock a user account, preventing them from logging in or using the
account.
"""
result = helper.api.user_lock(user_id)
result = helper.api.user_set_lock(user_id, True)
helper.output(result)


Expand All @@ -586,7 +586,7 @@ def unlock(helper, user_id):
Unlock a user account, allowing a locked account to log in and use the
account.
"""
result = helper.api.user_unlock(user_id)
result = helper.api.user_set_lock(user_id, False)
helper.output(result)


Expand Down

0 comments on commit 36585ab

Please sign in to comment.