pub struct DataManager(pub DataManager<Config>, pub DataManager);Tuple Fields§
§0: DataManager<Config>§1: DataManagerImplementations§
Source§impl DataManager
impl DataManager
pub async fn get_audit_log_entry_by_id( &self, selector: usize, ) -> Result<AuditLogEntry>
Sourcepub async fn get_audit_log_entries(
&self,
batch: usize,
page: usize,
) -> Result<Vec<AuditLogEntry>>
pub async fn get_audit_log_entries( &self, batch: usize, page: usize, ) -> Result<Vec<AuditLogEntry>>
Get all audit log entries (paginated).
§Arguments
batch- the limit of items in each pagepage- the page number
Sourcepub async fn create_audit_log_entry(&self, data: AuditLogEntry) -> Result<()>
pub async fn create_audit_log_entry(&self, data: AuditLogEntry) -> Result<()>
Create a new audit log entry in the database.
§Arguments
data- a mockAuditLogEntryobject to insert
pub async fn delete_audit_log_entry(&self, id: usize, user: User) -> Result<()>
Source§impl DataManager
impl DataManager
pub async fn get_ipban_by_ip(&self, selector: &str) -> Result<IpBan>
Sourcepub async fn get_ipban_by_addr(&self, addr: &RemoteAddr) -> Result<IpBan>
pub async fn get_ipban_by_addr(&self, addr: &RemoteAddr) -> Result<IpBan>
Sourcepub async fn get_ip_bans(&self, batch: usize, page: usize) -> Result<Vec<IpBan>>
pub async fn get_ip_bans(&self, batch: usize, page: usize) -> Result<Vec<IpBan>>
Get all IP bans (paginated).
§Arguments
batch- the limit of items in each pagepage- the page number
Sourcepub async fn create_ipban(&self, data: IpBan) -> Result<()>
pub async fn create_ipban(&self, data: IpBan) -> Result<()>
pub async fn delete_ipban(&self, ip: &str, user: User) -> Result<()>
Source§impl DataManager
impl DataManager
pub async fn get_notification_by_id(&self, id: usize) -> Result<Notification>
Sourcepub async fn get_notifications_by_owner(
&self,
owner: usize,
) -> Result<Vec<Notification>>
pub async fn get_notifications_by_owner( &self, owner: usize, ) -> Result<Vec<Notification>>
Get all notifications by owner.
Sourcepub async fn get_notifications_by_owner_paginated(
&self,
owner: usize,
batch: usize,
page: usize,
) -> Result<Vec<Notification>>
pub async fn get_notifications_by_owner_paginated( &self, owner: usize, batch: usize, page: usize, ) -> Result<Vec<Notification>>
Get all notifications by owner (paginated).
Sourcepub async fn get_notifications_by_tag(
&self,
tag: &str,
) -> Result<Vec<Notification>>
pub async fn get_notifications_by_tag( &self, tag: &str, ) -> Result<Vec<Notification>>
Get all notifications by tag.
Sourcepub async fn create_notification(&self, data: Notification) -> Result<()>
pub async fn create_notification(&self, data: Notification) -> Result<()>
pub async fn delete_notification(&self, id: usize, user: &User) -> Result<()>
pub async fn delete_all_notifications(&self, user: &User) -> Result<()>
pub async fn delete_all_notifications_by_tag( &self, user: &User, tag: &str, ) -> Result<()>
pub async fn update_notification_read( &self, id: usize, new_read: bool, user: &User, ) -> Result<()>
pub async fn update_all_notifications_read( &self, user: &User, read: bool, ) -> Result<()>
Source§impl DataManager
impl DataManager
pub async fn get_organization_membership_by_id( &self, selector: usize, ) -> Result<OrganizationMembership>
Sourcepub async fn get_organization_memberships_by_user(
&self,
user: usize,
) -> Result<Vec<OrganizationMembership>>
pub async fn get_organization_memberships_by_user( &self, user: usize, ) -> Result<Vec<OrganizationMembership>>
Get all organization_memberships by user.
§Arguments
user- the ID of the user to fetch organization_memberships for
Sourcepub async fn get_organization_memberships_by_organization(
&self,
organization: usize,
batch: usize,
page: usize,
) -> Result<Vec<OrganizationMembership>>
pub async fn get_organization_memberships_by_organization( &self, organization: usize, batch: usize, page: usize, ) -> Result<Vec<OrganizationMembership>>
Get all organization_memberships by organization (paginated).
§Arguments
organization- the ID of the user to fetch organization_memberships for
Sourcepub async fn get_organization_membership_by_owner_organization(
&self,
user: usize,
organization: usize,
) -> Result<OrganizationMembership>
pub async fn get_organization_membership_by_owner_organization( &self, user: usize, organization: usize, ) -> Result<OrganizationMembership>
Get an organization membership by user and organization.
§Arguments
user- the ID of the user to fetch organization_memberships fororg- the ID of the organization
Sourcepub async fn create_organization_membership(
&self,
data: OrganizationMembership,
) -> Result<()>
pub async fn create_organization_membership( &self, data: OrganizationMembership, ) -> Result<()>
Create a new organization_membership in the database.
§Arguments
data- a mockOrganizationMembershipobject to insert
pub async fn delete_organization_membership( &self, id: usize, user: User, ) -> Result<()>
pub async fn update_organization_membership_role( &self, id: usize, x: OrganizationRole, ) -> Result<()>
Source§impl DataManager
impl DataManager
pub async fn get_organization_by_id( &self, selector: usize, ) -> Result<Organization>
pub async fn get_organization_by_name( &self, selector: &str, ) -> Result<Organization>
Sourcepub async fn get_organizations_by_user(
&self,
user: usize,
) -> Result<Vec<Organization>>
pub async fn get_organizations_by_user( &self, user: usize, ) -> Result<Vec<Organization>>
Sourcepub async fn create_organization(&self, data: Organization) -> Result<usize>
pub async fn create_organization(&self, data: Organization) -> Result<usize>
pub async fn delete_organization(&self, id: usize, user: User) -> Result<()>
pub async fn update_organization_name(&self, id: usize, x: &str) -> Result<()>
pub async fn update_organization_roles( &self, id: usize, x: HashMap<usize, String>, ) -> Result<()>
pub async fn incr_organization_members(&self, id: usize) -> Result<()>
pub async fn decr_organization_members(&self, id: usize) -> Result<()>
Source§impl DataManager
impl DataManager
pub async fn get_permissions_list_by_id( &self, selector: usize, ) -> Result<PermissionsList>
Sourcepub async fn get_permissions_lists_by_organization(
&self,
organization: usize,
batch: usize,
page: usize,
) -> Result<Vec<PermissionsList>>
pub async fn get_permissions_lists_by_organization( &self, organization: usize, batch: usize, page: usize, ) -> Result<Vec<PermissionsList>>
Get all permissions_lists by organization (paginated).
§Arguments
organization- the ID of the user to fetch permissions_lists for
Sourcepub async fn create_permissions_list(
&self,
data: PermissionsList,
) -> Result<usize>
pub async fn create_permissions_list( &self, data: PermissionsList, ) -> Result<usize>
Create a new permissions_list in the database.
§Arguments
data- a mockPermissionsListobject to insert
pub async fn delete_permissions_list(&self, id: usize, user: User) -> Result<()>
pub async fn update_permissions_list_roles( &self, id: usize, x: Vec<usize>, ) -> Result<()>
Source§impl DataManager
impl DataManager
pub async fn get_property_by_id(&self, selector: usize) -> Result<Property>
Sourcepub async fn get_properties_by_user(&self, user: usize) -> Result<Vec<Property>>
pub async fn get_properties_by_user(&self, user: usize) -> Result<Vec<Property>>
Get all properties by user (paginated).
§Arguments
user- the ID of the user to fetch properties for
Sourcepub async fn create_property(&self, data: Property) -> Result<()>
pub async fn create_property(&self, data: Property) -> Result<()>
pub async fn delete_property(&self, id: usize, user: User) -> Result<()>
pub async fn update_property_custom_domain( &self, id: usize, x: &str, ) -> Result<()>
pub async fn update_property_name(&self, id: usize, x: &str) -> Result<()>
Source§impl DataManager
impl DataManager
pub async fn get_user_warning_by_id( &self, selector: usize, ) -> Result<UserWarning>
Sourcepub async fn get_user_warnings_by_user(
&self,
user: usize,
batch: usize,
page: usize,
) -> Result<Vec<UserWarning>>
pub async fn get_user_warnings_by_user( &self, user: usize, batch: usize, page: usize, ) -> Result<Vec<UserWarning>>
Get all user warnings by user (paginated).
§Arguments
user- the ID of the user to fetch warnings forbatch- the limit of items in each pagepage- the page number
Sourcepub async fn create_user_warning(&self, data: UserWarning) -> Result<()>
pub async fn create_user_warning(&self, data: UserWarning) -> Result<()>
pub async fn delete_user_warning(&self, id: usize, user: User) -> Result<()>
Source§impl DataManager
impl DataManager
pub async fn get_user_by_id(&self, selector: usize) -> Result<User>
pub async fn get_user_by_username(&self, selector: &str) -> Result<User>
pub async fn get_user_by_username_no_cache( &self, selector: &str, ) -> Result<User>
Sourcepub async fn get_user_by_id_with_void(&self, id: usize) -> Result<User>
pub async fn get_user_by_id_with_void(&self, id: usize) -> Result<User>
Get a user given just their ID. Returns the void user if the user doesn’t exist.
§Arguments
id- the ID of the user
Sourcepub async fn get_user_by_token(&self, token: &str) -> Result<User>
pub async fn get_user_by_token(&self, token: &str) -> Result<User>
Sourcepub async fn create_user(&self, data: User) -> Result<User>
pub async fn create_user(&self, data: User) -> Result<User>
Sourcepub async fn delete_user(
&self,
id: usize,
password: &str,
force: bool,
) -> Result<User>
pub async fn delete_user( &self, id: usize, password: &str, force: bool, ) -> Result<User>
Delete an existing user in the database.
§Arguments
id- the ID of the userpassword- the current password of the userforce- if we should delete even if the given password is incorrect
pub async fn update_user_verified_status( &self, id: usize, x: bool, user: User, ) -> Result<()>
pub async fn update_user_is_deactivated( &self, id: usize, x: bool, user: User, ) -> Result<()>
pub async fn update_user_password( &self, id: usize, from: String, to: String, user: User, force: bool, ) -> Result<()>
pub async fn update_user_username( &self, id: usize, to: String, user: User, ) -> Result<()>
Sourcepub fn check_totp(&self, ua: &User, code: &str) -> bool
pub fn check_totp(&self, ua: &User, code: &str) -> bool
Validate a given TOTP code for the given profile.
Sourcepub fn generate_totp_recovery_codes() -> Vec<String>
pub fn generate_totp_recovery_codes() -> Vec<String>
Generate 8 random recovery codes for TOTP.
Sourcepub async fn update_user_totp(
&self,
id: usize,
secret: &str,
recovery: &Vec<String>,
) -> Result<()>
pub async fn update_user_totp( &self, id: usize, secret: &str, recovery: &Vec<String>, ) -> Result<()>
Update the profile’s TOTP secret.
§Arguments
id- the ID of the usersecret- the TOTP secretrecovery- the TOTP recovery codes
Sourcepub async fn enable_totp(
&self,
id: usize,
user: User,
) -> Result<(String, String, Vec<String>)>
pub async fn enable_totp( &self, id: usize, user: User, ) -> Result<(String, String, Vec<String>)>
Sourcepub async fn get_principal_org(&self, user: &User) -> Option<Organization>
pub async fn get_principal_org(&self, user: &User) -> Option<Organization>
Get the given user’s principal organization.
pub async fn cache_clear_user(&self, user: &User)
pub async fn update_user_permissions( &self, id: usize, x: Vec<UserPermission>, ) -> Result<()>
pub async fn update_user_tokens(&self, id: usize, x: Vec<Token>) -> Result<()>
pub async fn update_user_settings( &self, id: usize, x: UserSettings, ) -> Result<()>
pub async fn update_user_ban_reason(&self, id: usize, x: &str) -> Result<()>
pub async fn update_user_ban_expire(&self, id: usize, x: i64) -> Result<()>
pub async fn update_user_checkouts( &self, id: usize, x: Vec<String>, ) -> Result<()>
pub async fn update_user_last_policy_consent( &self, id: usize, x: i64, ) -> Result<()>
pub async fn update_user_linked_accounts( &self, id: usize, x: UserLinkedAccounts, ) -> Result<()>
pub async fn update_user_badges( &self, id: usize, x: Vec<UserBadge>, ) -> Result<()>
pub async fn update_user_principal_org(&self, id: usize, x: i64) -> Result<()>
pub async fn update_user_org_as_tenant(&self, id: usize, x: i32) -> Result<()>
pub async fn get_user_by_stripe_id(&self, selector: &str) -> Result<User>
pub async fn update_user_stripe_id(&self, id: usize, x: &str) -> Result<()>
pub async fn update_user_notification_count( &self, id: usize, x: i32, ) -> Result<()>
pub async fn incr_user_notifications(&self, id: usize) -> Result<()>
pub async fn decr_user_notifications(&self, id: usize) -> Result<()>
pub async fn incr_user_org_creation_credits(&self, id: usize) -> Result<()>
pub async fn decr_user_org_creation_credits(&self, id: usize) -> Result<()>
Trait Implementations§
Source§impl Clone for DataManager
impl Clone for DataManager
Source§fn clone(&self) -> DataManager
fn clone(&self) -> DataManager
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for DataManager
impl !RefUnwindSafe for DataManager
impl Send for DataManager
impl Sync for DataManager
impl Unpin for DataManager
impl !UnwindSafe for DataManager
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more