rs-tenant 0.4.0

Multi-tenant RBAC authorization engine for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use super::{PlatformGrantScope, PlatformRoleId};

/// 平台角色分配及其显式授权范围。
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PlatformRoleAssignment {
    /// 被分配的平台角色。
    pub role: PlatformRoleId,
    /// 该平台分配授予的范围。
    pub scope: PlatformGrantScope,
}

impl PlatformRoleAssignment {
    /// 创建平台角色分配。
    pub fn new(role: PlatformRoleId, scope: PlatformGrantScope) -> Self {
        Self { role, scope }
    }
}