Provisioning API: Correctly process power level 0

This commit is contained in:
Christian Paul 2023-01-11 15:26:58 +01:00
parent 4048cc8b01
commit 7607955d7d

View File

@ -64,9 +64,9 @@ export async function assertUserPermissionsInRoom(userId: string, roomId: string
}
// TODO: Decide what PL consider "write" permissions
const botPl = pls.users?.[intent.userId] || pls.users_default || 0;
const userPl = pls.users?.[userId] || pls.users_default || 0;
const requiredPl = pls.state_default || 50;
const botPl = pls.users?.[intent.userId] ?? pls.users_default ?? 0;
const userPl = pls.users?.[userId] ?? pls.users_default ?? 0;
const requiredPl = pls.state_default ?? 50;
// Check the bot's permissions
if (botPl < requiredPl) {