Can create user accounts

This commit is contained in:
2022-04-07 18:59:48 +02:00
parent 52888b3af7
commit c9ca23cd82
11 changed files with 144 additions and 12 deletions

View File

@ -91,4 +91,21 @@ impl<E> EntityManager<E>
pub fn cloned(&self) -> Vec<E> {
self.list.clone()
}
pub fn update_or_replace(&mut self, entry: E) -> Res {
let mut found = false;
for i in &mut self.list {
if i == &entry {
*i = entry.clone();
found = true;
break;
}
}
if !found {
self.list.push(entry);
}
self.save()
}
}

View File

@ -22,6 +22,10 @@ pub struct User {
}
impl User {
pub fn full_name(&self) -> String {
format!("{} {}", self.first_name, self.last_name)
}
pub fn can_access_app(&self, id: &ClientID) -> bool {
match &self.authorized_clients {
None => true,