forked from jmug/stoatchat
Fix: Allow users with server overlap to access each other.
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export version=0.5.1-alpha.3
|
export version=0.5.1-alpha.4
|
||||||
echo "pub const VERSION: &str = \"${version}\";" > src/version.rs
|
echo "pub const VERSION: &str = \"${version}\";" > src/version.rs
|
||||||
|
|||||||
@@ -69,7 +69,31 @@ impl<'a> PermissionCalculator<'a> {
|
|||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let check_server_overlap = async || {
|
||||||
|
let server_ids = self.perspective.fetch_server_ids().await?;
|
||||||
|
|
||||||
|
Ok(
|
||||||
|
get_collection("server_members")
|
||||||
|
.find_one(
|
||||||
|
doc! {
|
||||||
|
"_id.user": &target,
|
||||||
|
"_id.server": {
|
||||||
|
"$in": server_ids
|
||||||
|
}
|
||||||
|
},
|
||||||
|
None
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.map_err(|_| Error::DatabaseError {
|
||||||
|
operation: "find_one",
|
||||||
|
with: "server_members",
|
||||||
|
})?
|
||||||
|
.is_some()
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
if self.has_mutual_connection
|
if self.has_mutual_connection
|
||||||
|
|| check_server_overlap().await?
|
||||||
|| get_collection("channels")
|
|| get_collection("channels")
|
||||||
.find_one(
|
.find_one(
|
||||||
doc! {
|
doc! {
|
||||||
@@ -84,7 +108,7 @@ impl<'a> PermissionCalculator<'a> {
|
|||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.map_err(|_| Error::DatabaseError {
|
.map_err(|_| Error::DatabaseError {
|
||||||
operation: "find",
|
operation: "find_one",
|
||||||
with: "channels",
|
with: "channels",
|
||||||
})?
|
})?
|
||||||
.is_some()
|
.is_some()
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
pub const VERSION: &str = "0.5.1-alpha.3";
|
pub const VERSION: &str = "0.5.1-alpha.4";
|
||||||
|
|||||||
Reference in New Issue
Block a user