pub struct FilterPolicy { /* private fields */ }Expand description
Filter policy engine.
The policy engine evaluates an ordered list of rules against file operations. Rules are evaluated in order, and the first matching rule determines the action. If no rules match, the default action is used.
Implementations§
Source§impl FilterPolicy
impl FilterPolicy
Sourcepub fn with_default(self, action: FilterResult) -> Self
pub fn with_default(self, action: FilterResult) -> Self
Set the default action for when no rules match.
Sourcepub fn with_enabled(self, enabled: bool) -> Self
pub fn with_enabled(self, enabled: bool) -> Self
Set whether filtering is enabled.
Sourcepub fn add_rule(self, rule: FilterRule) -> Self
pub fn add_rule(self, rule: FilterRule) -> Self
Add a rule to the policy.
Rules are evaluated in the order they are added.
Sourcepub fn add_rules(self, rules: impl IntoIterator<Item = FilterRule>) -> Self
pub fn add_rules(self, rules: impl IntoIterator<Item = FilterRule>) -> Self
Add multiple rules to the policy.
Sourcepub fn rule_count(&self) -> usize
pub fn rule_count(&self) -> usize
Get the number of rules in this policy.
Sourcepub fn default_action(&self) -> FilterResult
pub fn default_action(&self) -> FilterResult
Get the default action.
Sourcepub fn from_config(config: &FilterConfig) -> Result<Self>
pub fn from_config(config: &FilterConfig) -> Result<Self>
Create a policy from configuration.
Parses the filter configuration and creates matchers for each rule.
Trait Implementations§
Source§impl Clone for FilterPolicy
impl Clone for FilterPolicy
Source§fn clone(&self) -> FilterPolicy
fn clone(&self) -> FilterPolicy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FilterPolicy
impl Debug for FilterPolicy
Source§impl Default for FilterPolicy
impl Default for FilterPolicy
Source§fn from(policy: FilterPolicy) -> Self
fn from(policy: FilterPolicy) -> Self
Converts to this type from the input type.
Source§impl TransferFilter for FilterPolicy
impl TransferFilter for FilterPolicy
Source§fn check(&self, path: &Path, operation: Operation, user: &str) -> FilterResult
fn check(&self, path: &Path, operation: Operation, user: &str) -> FilterResult
Check if an operation is allowed on a given path. Read more
Source§fn is_enabled(&self) -> bool
fn is_enabled(&self) -> bool
Returns true if filtering is enabled.
Source§fn check_with_dest(
&self,
src: &Path,
dest: &Path,
operation: Operation,
user: &str,
) -> FilterResult
fn check_with_dest( &self, src: &Path, dest: &Path, operation: Operation, user: &str, ) -> FilterResult
Check if an operation involving source and destination paths is allowed. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for FilterPolicy
impl !UnwindSafe for FilterPolicy
impl Freeze for FilterPolicy
impl Send for FilterPolicy
impl Sync for FilterPolicy
impl Unpin for FilterPolicy
impl UnsafeUnpin for FilterPolicy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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