Fix moderators being able to change emails of admins
This commit is contained in:
parent
4bea3484d1
commit
661bb19de7
@ -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))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user