pub enum SecurityPolicy {
ReadOnly,
ReadWrite {
writable_records: HashSet<TypeId>,
},
}Expand description
Security policy for remote access
Defines which operations are permitted and for which records.
Variants§
ReadOnly
Read-only access (list, get, subscribe)
This is the default and recommended policy for most deployments. No write operations are permitted.
ReadWrite
Read-write access with explicit per-record opt-in
Write operations (record.set) are only allowed for records
whose TypeId is in the writable_records set.
Implementations§
Source§impl SecurityPolicy
impl SecurityPolicy
Sourcepub fn read_write() -> Self
pub fn read_write() -> Self
Creates a read-write policy with no writable records initially
Sourcepub fn allow_write<T: 'static>(&mut self)
pub fn allow_write<T: 'static>(&mut self)
Adds a record type to the writable set
Only has effect for ReadWrite policies. Panics if policy is ReadOnly.
Sourcepub fn is_writable(&self, type_id: TypeId) -> bool
pub fn is_writable(&self, type_id: TypeId) -> bool
Checks if a record type is writable
Sourcepub fn permissions(&self) -> &[&str]
pub fn permissions(&self) -> &[&str]
Returns the list of granted permissions
Sourcepub fn writable_records(&self) -> Vec<TypeId>
pub fn writable_records(&self) -> Vec<TypeId>
Returns the list of writable record TypeIds (for ReadWrite policy)
Source§impl SecurityPolicy
Builder helper for SecurityPolicy with chained API
impl SecurityPolicy
Builder helper for SecurityPolicy with chained API
Sourcepub fn with_writable_record<T: 'static>(self) -> Self
pub fn with_writable_record<T: 'static>(self) -> Self
Builder pattern: Creates ReadWrite policy and allows write for a type
Trait Implementations§
Source§impl Clone for SecurityPolicy
impl Clone for SecurityPolicy
Source§fn clone(&self) -> SecurityPolicy
fn clone(&self) -> SecurityPolicy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more