Fix moderators being able to change emails of admins

This commit is contained in:
rubenwardy 2018-05-14 14:46:32 +01:00
parent 4bea3484d1
commit 661bb19de7
No known key found for this signature in database
GPG Key ID: A1E29D52FF81513C
1 changed files with 1 additions and 1 deletions

View File

@ -121,7 +121,7 @@ class User(db.Model, UserMixin):
elif perm == Permission.CHANGE_RANK:
return user.rank.atLeast(UserRank.MODERATOR)
elif perm == Permission.CHANGE_EMAIL:
return user == self or user.rank.atLeast(UserRank.MODERATOR)
return user == self or (user.rank.atLeast(UserRank.MODERATOR) and user.rank.atLeast(self.rank))
else:
raise Exception("Permission {} is not related to users".format(perm.name))