Can create user accounts
This commit is contained in:
@ -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()
|
||||
}
|
||||
}
|
||||
|
@ -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,
|
||||
|
Reference in New Issue
Block a user