pub struct User {
pub user_id: String,
pub display_name: String,
pub email: Option<String>,
pub persona: UserPersona,
pub department: Option<String>,
pub working_hours: WorkingHoursPattern,
pub company_codes: Vec<String>,
pub cost_centers: Vec<String>,
pub is_active: bool,
pub start_date: Option<NaiveDate>,
pub end_date: Option<NaiveDate>,
}Expand description
Individual user account for transaction attribution.
Fields§
§user_id: StringUser ID (login name)
display_name: StringDisplay name
email: Option<String>Email address
persona: UserPersonaPersona classification
department: Option<String>Department
working_hours: WorkingHoursPatternWorking hours pattern
company_codes: Vec<String>Assigned company codes
cost_centers: Vec<String>Assigned cost centers (can post to)
is_active: boolIs this user currently active
start_date: Option<NaiveDate>Start date of employment
end_date: Option<NaiveDate>End date of employment (if terminated)
Implementations§
Source§impl User
impl User
Sourcepub fn new(user_id: String, display_name: String, persona: UserPersona) -> Self
pub fn new(user_id: String, display_name: String, persona: UserPersona) -> Self
Create a new user with minimal required fields.
Sourcepub fn can_post_to_company(&self, company_code: &str) -> bool
pub fn can_post_to_company(&self, company_code: &str) -> bool
Check if user can post to a company code.
Sourcepub fn generate_username(persona: UserPersona, index: usize) -> String
pub fn generate_username(persona: UserPersona, index: usize) -> String
Generate a typical username for a persona.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for User
impl<'de> Deserialize<'de> for User
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for User
impl RefUnwindSafe for User
impl Send for User
impl Sync for User
impl Unpin for User
impl UnwindSafe for User
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more