Skip to content

Commit

Permalink
Merge pull request #944 from bonnedav/patch-1
Browse files Browse the repository at this point in the history
Fix moderators disabling administrators.
  • Loading branch information
evgenyfadeev authored Aug 26, 2024
2 parents ee5e4bd + 7ff779b commit 37ddfbb
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 37ddfbb

Please sign in to comment.