be able to update data individually; Fixes #951
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
use super::User;
|
||||
use crate::model::user::LoginError;
|
||||
use crate::{
|
||||
model::{mail::Mail, notification::Notification, role::Role},
|
||||
model::{mail::Mail, notification::Notification},
|
||||
special_user, SCHECKBUCH,
|
||||
};
|
||||
use rocket::async_trait;
|
||||
@ -16,24 +16,24 @@ use std::ops::Deref;
|
||||
special_user!(ScheckbuchUser, +"scheckbuch");
|
||||
|
||||
impl ScheckbuchUser {
|
||||
async fn from(user: User, db: &SqlitePool, mail: &str, smtp_pw: &str) -> Result<(), String> {
|
||||
// TODO: see when/how to invoke this function (explicit `Neue Person hinzufügen` button?
|
||||
// Button to transition existing users to scheckbuch? Automatically called when
|
||||
// `scheckbuch` is newly selected as role?
|
||||
if user.has_role(db, "scheckbuch").await {
|
||||
return Err("User is already a scheckbuch".into());
|
||||
}
|
||||
//async fn from(user: User, db: &SqlitePool, mail: &str, smtp_pw: &str) -> Result<(), String> {
|
||||
// // TODO: see when/how to invoke this function (explicit `Neue Person hinzufügen` button?
|
||||
// // Button to transition existing users to scheckbuch? Automatically called when
|
||||
// // `scheckbuch` is newly selected as role?
|
||||
// if user.has_role(db, "scheckbuch").await {
|
||||
// return Err("User is already a scheckbuch".into());
|
||||
// }
|
||||
|
||||
// TODO: do we allow e.g. DonauLinz to scheckbuch?
|
||||
// // TODO: do we allow e.g. DonauLinz to scheckbuch?
|
||||
|
||||
let scheckbuch = Role::find_by_name(db, "scheckbuch").await.unwrap();
|
||||
user.add_role(db, &scheckbuch).await.unwrap();
|
||||
// let scheckbuch = Role::find_by_name(db, "scheckbuch").await.unwrap();
|
||||
// user.add_role(db, &scheckbuch).await.unwrap();
|
||||
|
||||
// TODO: remove all other `membership_type` roles
|
||||
let new_user = Self::new(db, &user).await.unwrap();
|
||||
// // TODO: remove all other `membership_type` roles
|
||||
// let new_user = Self::new(db, &user).await.unwrap();
|
||||
|
||||
new_user.notify(db, mail, smtp_pw).await
|
||||
}
|
||||
// new_user.notify(db, mail, smtp_pw).await
|
||||
//}
|
||||
|
||||
pub(crate) async fn notify(
|
||||
&self,
|
||||
|
Reference in New Issue
Block a user