Forbid joining projects if users are not contacts

This commit is contained in:
Antonio Scandurra 2022-05-09 15:51:54 +02:00
parent 95d29c4a7b
commit ca56b0d6d5
2 changed files with 130 additions and 46 deletions

View file

@ -629,9 +629,10 @@ impl Store {
.connection_ids())
}
#[cfg(test)]
pub fn project(&self, project_id: u64) -> Option<&Project> {
self.projects.get(&project_id)
pub fn project(&self, project_id: u64) -> Result<&Project> {
self.projects
.get(&project_id)
.ok_or_else(|| anyhow!("no such project"))
}
pub fn read_project(&self, project_id: u64, connection_id: ConnectionId) -> Result<&Project> {