mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
federation/eventauth: fix checking user power level changes
This commit is contained in:
parent
a3c6832c48
commit
ae6a0b4f51
1 changed files with 3 additions and 2 deletions
|
|
@ -664,8 +664,9 @@ func allowPowerChangeMap(roomVersion id.RoomVersion, maxVal int, path, ownID str
|
|||
newVal := new.Get(exgjson.Path(key.Str))
|
||||
err = allowPowerChange(roomVersion, maxVal, path+"."+key.Str, value, newVal)
|
||||
if err == nil && ownID != "" && key.Str != ownID {
|
||||
val := parseIntWithVersion(roomVersion, value)
|
||||
if *val >= maxVal {
|
||||
parsedOldVal := parseIntWithVersion(roomVersion, value)
|
||||
parsedNewVal := parseIntWithVersion(roomVersion, newVal)
|
||||
if *parsedOldVal >= maxVal && *parsedOldVal != *parsedNewVal {
|
||||
err = fmt.Errorf("%w: can't change users.%s from %s to %s with sender level %d", ErrInvalidPowerChange, key.Str, stringifyForError(value), stringifyForError(newVal), maxVal)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue