darkwing/database/browser_profile_access/model.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
//! Browser profile access control module that manages permissions for browser
//! profiles.
//!
//! This module handles the database representation of access control for
//! browser profiles, where permissions are stored as MySQL boolean values
//! (represented as i8 in Rust). A value of 1 indicates true/granted, while 0
//! indicates false/denied.
#![allow(
non_snake_case,
reason = "sqlx query_as macro does not support FromRow trait, so we cant use renamed fields. see https://github.com/launchbadge/sqlx/issues/1372 and https://github.com/launchbadge/sqlx/issues/514"
)]
use sqlx::FromRow;
/// Represents access control permissions for a browser profile associated with
/// a role.
///
/// This struct maps directly to the database table structure, where boolean
/// permissions are stored as i8 values (MySQL's way of storing booleans).
#[derive(FromRow, Debug, Default)]
#[allow(unused)]
pub struct BrowserProfileAccess {
/// The ID of the role these permissions are associated with
pub roleId: i64,
/// Permission to use/execute the browser profile (1 = allowed, 0 = denied)
pub usage: i8,
/// Permission to view the browser profile details (1 = allowed, 0 = denied)
pub view: i8,
/// Permission to modify the browser profile (1 = allowed, 0 = denied)
pub update: i8,
/// Permission to share the browser profile with others (1 = allowed, 0 =
/// denied)
pub share: i8,
/// Permission to delete the browser profile (1 = allowed, 0 = denied)
pub delete: i8,
/// Optional permission to transfer ownership of the browser profile (1 =
/// allowed, 0 = denied, None = not applicable)
pub transfer: Option<i8>,
}