pub struct Profile {Show 13 fields
pub owners: Vec<Owner>,
pub acc_id: Uuid,
pub is_subscription: bool,
pub is_manager: bool,
pub is_staff: bool,
pub owner_is_active: bool,
pub account_is_active: bool,
pub account_was_approved: bool,
pub account_was_archived: bool,
pub account_was_deleted: bool,
pub verbose_status: Option<VerboseStatus>,
pub licensed_resources: Option<LicensedResources>,
pub tenants_ownership: Option<TenantsOwnership>,
/* private fields */
}
Expand description
This is a re-exportation from the myc core to allow users to import both from myc-api instead of the myc-core. This object should be used over the application layer operations.
Fields§
§owners: Vec<Owner>
§acc_id: Uuid
The account unique id
Such ID is related to the account primary-key instead of the owner
primary key. In the case of the subscription accounts (accounts flagged
with is_subscription
) such ID should be propagated along the
application flow.
is_subscription: bool
If profile belongs to a subscription
account
Subscription accounts should be used to manage legal entities. Only subscription accounts should receive guest accounts.
is_manager: bool
If profile belongs to a manager
account
Manager accounts should be used by users with elevated privileges inside the Mycelium platform. Such user should perform actions like create roles, guest-roles, guest default-user accounts to work into subscription accounts.
is_staff: bool
If profile belongs to a staff
account
Staff user has elevated roles into the application. Like managers, staff users has elevated privileges. Only staff user has permission to delegate other staffs.
owner_is_active: bool
If the account owner is active
Profiles exists to abstract account privileges. If the profile is related to an inactive owner the profile could not perform any action. Only staff or manager user should perform the activation of such users.
account_is_active: bool
If the account itself is inactive
When inactive accounts should not perform internal operations.
account_was_approved: bool
If the account was approved after registration
New accounts should be approved by manager or staff users after their registration into the Mycelium platform. Case the approval was performed, this flag should be true.
account_was_archived: bool
If the account was archived after registration
New accounts should be archived. After archived accounts should not be included at default filtering actions.
account_was_deleted: bool
If the account was deleted after registration
New accounts should be deleted. After deleted accounts should not be included at default filtering actions.
verbose_status: Option<VerboseStatus>
Indicate the profile status for humans
The profile status is composed of all account flags statuses composition. But it is not readable for humans. These struct attribute allows human users to understand the account status without read the flags, avoiding misinterpretation of this.
licensed_resources: Option<LicensedResources>
Accounts guested to the current profile
Guest accounts delivers information about the guest account role and their respective permissions inside the host account. A single account should be several licenses into the same account.
tenants_ownership: Option<TenantsOwnership>
Tenants which the profile has ownership
This field should be used to store the tenants that the profile has ownership. The ownership should be used to filter the licensed resources during system validations.
Implementations§
Source§impl Profile
impl Profile
pub fn new( owners: Vec<Owner>, acc_id: Uuid, is_subscription: bool, is_manager: bool, is_staff: bool, owner_is_active: bool, account_is_active: bool, account_was_approved: bool, account_was_archived: bool, account_was_deleted: bool, verbose_status: Option<VerboseStatus>, licensed_resources: Option<LicensedResources>, tenants_ownership: Option<TenantsOwnership>, ) -> Profile
pub fn profile_string(&self) -> String
Sourcepub fn profile_redacted(&self) -> String
pub fn profile_redacted(&self) -> String
Redacted profile string
Print the profile using the profile_string struct method and a list of
owners, using the redacted_email
structural method of the email field
present in owners.
pub fn get_owners_ids(&self) -> Vec<Uuid>
pub fn has_admin_privileges(&self) -> bool
pub fn has_admin_privileges_or_error(&self) -> Result<(), MappedErrors>
Sourcepub fn on_tenant(&self, tenant_id: Uuid) -> Profile
pub fn on_tenant(&self, tenant_id: Uuid) -> Profile
Filter the licensed resources to the tenant
This method should be used to filter licensed resources to the tenant that the profile is currently working on.
Sourcepub fn on_account(&self, account_id: Uuid) -> Profile
pub fn on_account(&self, account_id: Uuid) -> Profile
Filter the licensed resources to the account
This method should be used to filter licensed resources to the account that the profile is currently working on.
Sourcepub fn with_tenant_ownership_or_error(
&self,
tenant_id: Uuid,
) -> Result<Profile, MappedErrors>
pub fn with_tenant_ownership_or_error( &self, tenant_id: Uuid, ) -> Result<Profile, MappedErrors>
Filter the tenant ownership by the tenant
Sourcepub fn with_system_accounts_access(&self) -> Profile
pub fn with_system_accounts_access(&self) -> Profile
Filter the licensed resources to include only the standard system accounts
Sourcepub fn with_read_access(&self) -> Profile
pub fn with_read_access(&self) -> Profile
Filter the licensed resources to include only licenses with read access
Sourcepub fn with_write_access(&self) -> Profile
pub fn with_write_access(&self) -> Profile
Filter the licensed resources to include only licenses with write access