0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-25 15:04:10 +01:00

modules/m_room_power_levels: Diverge auth rule 10.b.

This commit is contained in:
Jason Volk 2019-08-10 00:53:38 -07:00
parent 111ffd2216
commit 07cdc73593

View file

@ -89,12 +89,40 @@ ircd::m::auth_room_power_levels(const m::event &event,
};
}
// b. If there is no previous m.room.power_levels event in the room, allow.
if(!data.auth_power)
// // b. If there is no previous m.room.power_levels event in the room, allow.
// if(!data.auth_power)
// {
// data.allow = true;
// return;
// };
// b'. If there is no previous m.room.power_levels event in the room,
// allow if the sender is the room creator.
if(!data.auth_power && data.auth_create && data.auth_member_sender)
{
data.allow = true;
return;
};
const json::string &creator
{
json::get<"content"_>(*data.auth_create).get("creator")
};
if(creator == json::get<"state_key"_>(*data.auth_member_sender))
{
data.allow = true;
return;
}
}
if(!data.auth_power)
throw FAIL
{
"Cannot create the m.room.power_levels event."
};
if(!data.auth_create)
throw FAIL
{
"Missing m.room.create in auth_events."
};
const m::room::power old_power
{