Files
synapse/tests
7a974c88df Add the recipient_permission push condition (MSC4506)
MSC4506 adds `org.matrix.msc4506.recipient_permission`, a push rule
condition that matches when the user the rules are evaluated for has at
least the power level required for the `m.room.power_levels` action named
by `key` ("invite", "kick", "ban" or "redact"). No existing condition can
express "this recipient can invite", which the knock rule needs.

The bulk evaluator passes the evaluator the required level for each action
and passes `run` the recipient's own level. The recipient level comes from
`get_user_power_level`, the helper the auth rules use. Room creators in
room versions with MSC4289 hold an implicit power level and have no entry
in `m.room.power_levels->users`, so reading `users` directly would miss
them.

Old room versions allow null, float and string levels. A null or
unparseable action level coerces to the spec default for that action, as
`get_named_level` does, so a null `invite` reads as 0 and not as a level
nobody reaches.

The condition stays inert while `experimental_features.msc4506_enabled` is
off: the evaluator gets no action levels and no recipient level, so a
user-defined rule carrying the condition never matches either. The Rust
tests and the benchmark pass the new arguments.

Co-authored-by: Quentin Gliech <quenting@element.io>

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-30 10:20:35 +01:00
..
2026-09-18 12:00:45 +01:00