more rights to the kiosk!

This commit is contained in:
philipp 2023-10-31 22:41:12 +01:00
parent 7a622a5615
commit 2eba6a0f66

View File

@ -210,10 +210,19 @@ async fn create_kiosk(
data: Form<LogToAdd>, data: Form<LogToAdd>,
_kiosk: KioskCookie, _kiosk: KioskCookie,
) -> Flash<Redirect> { ) -> Flash<Redirect> {
let creator = if let Some(shipmaster) = data.shipmaster { let Some(boat) = Boat::find_by_id(db, data.boat_id).await else {
return Flash::error(Redirect::to("/log"), "Boot gibt's nicht");
};
let creator = if boat.amount_seats == 1 && boat.owner.is_some() {
User::find_by_id(db, boat.owner.unwrap() as i32)
.await
.unwrap()
} else {
if let Some(shipmaster) = data.shipmaster {
User::find_by_id(db, shipmaster as i32).await.unwrap() User::find_by_id(db, shipmaster as i32).await.unwrap()
} else { } else {
User::find_by_id(db, data.rowers[0] as i32).await.unwrap() User::find_by_id(db, data.rowers[0] as i32).await.unwrap()
}
}; };
Log::create( Log::create(
db, db,