only allow people with 'donau linz' role to be in logbook #350

Merged
philipp merged 2 commits from staging into main 2024-04-08 19:05:35 +02:00
Showing only changes of commit db3158d4e7 - Show all commits

View File

@ -1,5 +1,6 @@
use std::net::IpAddr;
use futures::{stream, StreamExt};
use rocket::{
form::Form,
get,
@ -49,20 +50,24 @@ async fn index(
) -> Template {
let boats = Boat::for_user(db, &user).await;
let coxes: Vec<UserWithWaterStatus> = futures::future::join_all(
let mut coxes: Vec<UserWithWaterStatus> = futures::future::join_all(
User::cox(db)
.await
.into_iter()
.map(|user| UserWithWaterStatus::from_user(user, db)),
)
.await;
let users: Vec<UserWithWaterStatus> = futures::future::join_all(
coxes.retain(|u| u.roles.contains(&"Donau Linz".into()));
let mut users: Vec<UserWithWaterStatus> = futures::future::join_all(
User::all(db)
.await
.into_iter()
.map(|user| UserWithWaterStatus::from_user(user, db)),
)
.await;
users.retain(|u| u.roles.contains(&"Donau Linz".into()));
let logtypes = LogType::all(db).await;
let distances = Logbook::distances(db).await;