pub struct ActorAcl {
pub rowid: Option<i64>,
pub realm_id: u32,
pub source_realm_id: Option<u32>,
pub from_type: String,
pub to_type: String,
pub access: bool,
}Expand description
Actor 访问控制列表
管理不同类型 Actor 之间的访问权限
Fields§
§rowid: Option<i64>§realm_id: u32目标(被访问方)所在 realm
source_realm_id: Option<u32>来源(访问方)所在 realm;None 表示未设置来源范围
from_type: String§to_type: String§access: boolImplementations§
Source§impl ActorAcl
impl ActorAcl
Sourcepub fn new(
realm_id: u32,
from_type: String,
to_type: String,
access: bool,
) -> Self
pub fn new( realm_id: u32, from_type: String, to_type: String, access: bool, ) -> Self
创建新的访问控制规则
Sourcepub fn new_with_source_realm(
realm_id: u32,
source_realm_id: Option<u32>,
from_type: String,
to_type: String,
access: bool,
) -> Self
pub fn new_with_source_realm( realm_id: u32, source_realm_id: Option<u32>, from_type: String, to_type: String, access: bool, ) -> Self
创建带来源 realm 约束的访问控制规则
Sourcepub async fn save(&mut self) -> Result<i64, RealmError>
pub async fn save(&mut self) -> Result<i64, RealmError>
Save ACL rule to database
Inserts a new rule or updates existing one based on rowid.
§Returns
Returns the rowid of the saved ACL rule
Sourcepub async fn delete_by_id(id: i64) -> Result<u64, RealmError>
pub async fn delete_by_id(id: i64) -> Result<u64, RealmError>
Sourcepub async fn get_by_realm(realm_id: u32) -> Result<Vec<Self>, RealmError>
pub async fn get_by_realm(realm_id: u32) -> Result<Vec<Self>, RealmError>
获取指定 Realm 的所有访问控制规则
Sourcepub async fn get_by_types(
target_realm_id: u32,
source_realm_id: u32,
from_type: &str,
to_type: &str,
) -> Result<Option<Self>, RealmError>
pub async fn get_by_types( target_realm_id: u32, source_realm_id: u32, from_type: &str, to_type: &str, ) -> Result<Option<Self>, RealmError>
根据类型获取访问控制规则
Sourcepub async fn delete_by_target(
realm_id: u32,
to_type: &str,
) -> Result<u64, RealmError>
pub async fn delete_by_target( realm_id: u32, to_type: &str, ) -> Result<u64, RealmError>
删除指定目标类型的全部 ACL(用于服务重注册时替换旧 ACL)
pub fn access(&self) -> bool
Sourcepub async fn can_discover(
source_realm_id: u32,
target_realm_id: u32,
from_type: &str,
to_type: &str,
) -> Result<bool, RealmError>
pub async fn can_discover( source_realm_id: u32, target_realm_id: u32, from_type: &str, to_type: &str, ) -> Result<bool, RealmError>
Check if discovery is allowed between two actor types
Used for Presence notification filtering and service discovery
§Arguments
source_realm_id: 来源 Actor 的 realmtarget_realm_id: 目标 Actor 的 realmfrom_type: Source actor typeto_type: Target actor type
§Returns
Returns true if discovery is allowed, false otherwise. Default policy: deny if no rule exists (secure by default)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ActorAcl
impl<'de> Deserialize<'de> for ActorAcl
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 ActorAcl
impl RefUnwindSafe for ActorAcl
impl Send for ActorAcl
impl Sync for ActorAcl
impl Unpin for ActorAcl
impl UnsafeUnpin for ActorAcl
impl UnwindSafe for ActorAcl
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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>
Converts
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>
Converts
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request