pub struct SubscriptionPolicy {
pub owner_path: String,
pub identity_field: String,
pub bypass_roles: Vec<String>,
}Expand description
An entity’s row-visibility policy for subscription delivery (#596).
Declared per entity in the compiled schema
(TypeDefinition::subscription_policy):
"subscription_policy": {
"owner_path": "$.owner_id", // single-level path into the after-image
"identity_field": "user_id", // the fraiseql.enriched.* field (#539)
"bypass_roles": ["admin"] // roles that get full visibility
}Fields§
§owner_path: StringThe single-level JSON path into the after-image holding the owner id
(e.g. "$.owner_id"). Only $.<field> is supported — the delivery matchers
key on a flat field name.
identity_field: StringThe enriched-identity field (in the fraiseql.enriched.* namespace, #539)
whose value the owner must equal (e.g. "user_id").
bypass_roles: Vec<String>Roles that bypass the policy entirely (full visibility, e.g. ["admin"]).
Implementations§
Source§impl SubscriptionPolicy
impl SubscriptionPolicy
Sourcepub fn owner_field(&self) -> &str
pub fn owner_field(&self) -> &str
The flat owner field name the delivery matchers key on — owner_path with a
leading $. stripped.
Sourcepub fn validate(&self) -> Result<(), String>
pub fn validate(&self) -> Result<(), String>
Validate the policy at load time.
§Errors
owner_pathis empty or a nested path (only single-level$.<field>).identity_fieldis empty.
Sourcepub fn derive(
&self,
attributes: &HashMap<String, Value>,
roles: &[String],
) -> OwnerCondition
pub fn derive( &self, attributes: &HashMap<String, Value>, roles: &[String], ) -> OwnerCondition
Derive the owner condition for a connection whose enriched identity is in
attributes and whose roles are roles (#596). Bypass role →
Bypass; a resolvable identity →
Eq; otherwise fail-closed
Refuse.
The identity value is read only from the server-resolved
fraiseql.enriched.* namespace — the #539 resolver strips any inbound
fraiseql.* claims, so a client-supplied plain attribute cannot widen
visibility.
Trait Implementations§
Source§impl Clone for SubscriptionPolicy
impl Clone for SubscriptionPolicy
Source§fn clone(&self) -> SubscriptionPolicy
fn clone(&self) -> SubscriptionPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SubscriptionPolicy
impl Debug for SubscriptionPolicy
Source§impl<'de> Deserialize<'de> for SubscriptionPolicy
impl<'de> Deserialize<'de> for SubscriptionPolicy
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>,
impl Eq for SubscriptionPolicy
Source§impl PartialEq for SubscriptionPolicy
impl PartialEq for SubscriptionPolicy
Source§impl Serialize for SubscriptionPolicy
impl Serialize for SubscriptionPolicy
impl StructuralPartialEq for SubscriptionPolicy
Auto Trait Implementations§
impl Freeze for SubscriptionPolicy
impl RefUnwindSafe for SubscriptionPolicy
impl Send for SubscriptionPolicy
impl Sync for SubscriptionPolicy
impl Unpin for SubscriptionPolicy
impl UnsafeUnpin for SubscriptionPolicy
impl UnwindSafe for SubscriptionPolicy
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.