Reject key requests for users that are not members of the room

This commit is contained in:
Konstantinos Sideris 2018-07-21 21:40:11 +03:00
parent a823a43686
commit 5dfd26abc5
3 changed files with 24 additions and 0 deletions

View file

@ -1714,6 +1714,19 @@ Cache::getMembers(const std::string &room_id, std::size_t startIndex, std::size_
return members;
}
bool
Cache::isRoomMember(const std::string &user_id, const std::string &room_id)
{
auto txn = lmdb::txn::begin(env_);
auto db = getMembersDb(txn, room_id);
lmdb::val value;
bool res = lmdb::dbi_get(txn, db, lmdb::val(user_id), value);
txn.commit();
return res;
}
void
Cache::saveTimelineMessages(lmdb::txn &txn,
const std::string &room_id,