in preparation to moving userdata into app, we switched to arbitrary groups
All checks were successful
CI/CD Pipeline / test (push) Successful in 11m4s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped

This commit is contained in:
2023-12-23 21:27:52 +01:00
parent e4da952a62
commit c7d7d0ca83
29 changed files with 396 additions and 256 deletions

View File

@@ -141,7 +141,7 @@ ORDER BY created_at DESC
.map_err(|e| e.to_string())?;
let user = User::find_by_id(db, boat.user_id_fixed).await.unwrap();
if user.is_tech {
if user.has_role(db, "tech").await {
return self
.verified(
db,
@@ -162,7 +162,7 @@ ORDER BY created_at DESC
boat: BoatDamageVerified<'_>,
) -> Result<(), String> {
if let Some(verifier) = User::find_by_id(db, boat.user_id_verified).await {
if !verifier.is_tech {
if !verifier.has_role(db, "tech").await {
Log::create(db, format!("User {verifier:?} tried to verify boat {boat:?}. The user is no tech. Manually craftted request?")).await;
return Err("You are not allowed to verify the boat!".into());
}