pub struct User {Show 15 fields
pub id: UserId,
pub email: Option<String>,
pub name: Option<String>,
pub role: UserRole,
pub enabled: bool,
pub oauth_provider: Option<String>,
pub oauth_subject: Option<String>,
pub groups: Vec<String>,
pub static_ip: Option<VpnAddress>,
pub custom_routes: Vec<Route>,
pub max_sessions: u32,
pub created_at: DateTime<Utc>,
pub last_login: Option<DateTime<Utc>>,
pub expires_at: Option<DateTime<Utc>>,
pub metadata: HashMap<String, String>,
}Expand description
VPN User
Fields§
§id: UserIdUnique user ID
email: Option<String>Email address
name: Option<String>Display name
role: UserRoleUser role
enabled: boolWhether user is enabled
oauth_provider: Option<String>OAuth2 provider (if using OAuth2)
oauth_subject: Option<String>OAuth2 subject claim
groups: Vec<String>Groups the user belongs to
static_ip: Option<VpnAddress>Static VPN IP (if configured)
custom_routes: Vec<Route>Custom routes for this user
max_sessions: u32Maximum concurrent sessions
created_at: DateTime<Utc>User creation time
last_login: Option<DateTime<Utc>>Last login time
expires_at: Option<DateTime<Utc>>Account expiration (if set)
metadata: HashMap<String, String>Additional metadata
Implementations§
Source§impl User
impl User
Sourcepub fn from_oauth(
provider: &str,
subject: &str,
email: Option<&str>,
name: Option<&str>,
groups: Vec<String>,
) -> Self
pub fn from_oauth( provider: &str, subject: &str, email: Option<&str>, name: Option<&str>, groups: Vec<String>, ) -> Self
Create from OAuth2 claims
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if user is expired
Sourcepub fn can_connect(&self) -> bool
pub fn can_connect(&self) -> bool
Check if user can connect
Sourcepub fn record_login(&mut self)
pub fn record_login(&mut self)
Record login
Sourcepub fn with_email(self, email: &str) -> Self
pub fn with_email(self, email: &str) -> Self
Set email
Sourcepub fn remove_group(&mut self, group: &str)
pub fn remove_group(&mut self, group: &str)
Remove from group
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