Skip to content

Commit

Permalink
User.can_terminate_account: non-admins cannot terminate terminate adm…
Browse files Browse the repository at this point in the history
…in or moderator accounts addresses issue #943
  • Loading branch information
evgenyfadeev committed Aug 20, 2024
1 parent 50cde79 commit 04e1d25
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions askbot/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,11 @@ def user_can_terminate_account(self, user):
if is_admin: #admin can't remove own account, as as safeguard
return False
return perm == 'users'

# non-admins with terminate_accounts role cannot remove admins or moderators
if not self.is_administrator() and user.is_administrator_or_moderator():
return False

return is_admin


Expand Down

0 comments on commit 04e1d25

Please sign in to comment.