Start to build edit user form
This commit is contained in:
@ -18,12 +18,12 @@ pub struct User {
|
||||
|
||||
/// None = all services
|
||||
/// Some([]) = no service
|
||||
pub authorized_services: Option<Vec<ClientID>>,
|
||||
pub authorized_clients: Option<Vec<ClientID>>,
|
||||
}
|
||||
|
||||
impl User {
|
||||
pub fn can_access_app(&self, id: &ClientID) -> bool {
|
||||
match &self.authorized_services {
|
||||
match &self.authorized_clients {
|
||||
None => true,
|
||||
Some(c) => c.contains(id)
|
||||
}
|
||||
@ -54,7 +54,7 @@ impl Default for User {
|
||||
need_reset_password: false,
|
||||
enabled: true,
|
||||
admin: false,
|
||||
authorized_services: Some(Vec::new()),
|
||||
authorized_clients: Some(Vec::new()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ async fn main() -> std::io::Result<()> {
|
||||
username: DEFAULT_ADMIN_USERNAME.to_string(),
|
||||
password: hash_password(DEFAULT_ADMIN_PASSWORD).unwrap(),
|
||||
need_reset_password: true,
|
||||
authorized_services: None,
|
||||
authorized_clients: None,
|
||||
admin: true,
|
||||
..Default::default()
|
||||
};
|
||||
|
Reference in New Issue
Block a user