Skip to content

Commit

Permalink
WHO_CAN_ANONYMIZE_ACCOUNTS
Browse files Browse the repository at this point in the history
Fix for #943 .
  • Loading branch information
bonnedav authored Aug 21, 2024
1 parent ee5e4bd commit 7ff779b
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 @@ -527,6 +527,11 @@ def user_has_badge(self, badge):
def user_can_anonymize_account(self, user):
"""`True`, if `self` can anonymize and disable account of `user`"""
perm = askbot_settings.WHO_CAN_ANONYMIZE_ACCOUNTS

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

if perm == 'admins':
return self.is_administrator() and self.pk != user.pk
elif self.is_administrator_or_moderator():
Expand Down

0 comments on commit 7ff779b

Please sign in to comment.