mirror of
https://github.com/Blah-IM/blahrs.git
synced 2025-05-01 00:31:09 +00:00
Fix room permission check
This commit is contained in:
parent
d672d067cd
commit
4456513139
2 changed files with 4 additions and 2 deletions
|
@ -452,11 +452,13 @@ async fn room_post_item(
|
|||
JOIN `room_member` USING (`rid`)
|
||||
JOIN `user` USING (`uid`)
|
||||
WHERE `ruuid` = :ruuid AND
|
||||
`userkey` = :userkey
|
||||
`userkey` = :userkey AND
|
||||
(`room_member`.`permission` & :perm) = :perm
|
||||
",
|
||||
named_params! {
|
||||
":ruuid": ruuid,
|
||||
":userkey": &chat.signee.user,
|
||||
":perm": RoomPermission::POST_CHAT,
|
||||
},
|
||||
|row| Ok((row.get::<_, u64>("rid")?, row.get::<_, u64>("uid")?)),
|
||||
)
|
||||
|
|
|
@ -125,7 +125,7 @@ bitflags! {
|
|||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct RoomPermission: u64 {
|
||||
const PUSH_CHAT = 1 << 0;
|
||||
const POST_CHAT = 1 << 0;
|
||||
const ADD_MEMBER = 1 << 1;
|
||||
|
||||
const ALL = !0;
|
||||
|
|
Loading…
Add table
Reference in a new issue