Skip to content

Commit 37ddfbb

Browse files
authored
Merge pull request #944 from bonnedav/patch-1
Fix moderators disabling administrators.
2 parents ee5e4bd + 7ff779b commit 37ddfbb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

askbot/models/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,11 @@ def user_has_badge(self, badge):
527527
def user_can_anonymize_account(self, user):
528528
"""`True`, if `self` can anonymize and disable account of `user`"""
529529
perm = askbot_settings.WHO_CAN_ANONYMIZE_ACCOUNTS
530+
531+
# non-admins cannot remove admins or moderators
532+
if not self.is_administrator() and user.is_administrator_or_moderator():
533+
return False
534+
530535
if perm == 'admins':
531536
return self.is_administrator() and self.pk != user.pk
532537
elif self.is_administrator_or_moderator():

0 commit comments

Comments
 (0)