pub struct FolderPermissionRule {
pub folder_id: Option<String>,
pub file_id: Option<String>,
pub recursive: bool,
pub allow: HashSet<DriveOperation>,
pub deny: HashSet<DriveOperation>,
pub require_lease: bool,
}Expand description
One configured permission rule, keyed on either a folder id or a
file id — exactly one of the two, enforced when the settings file is
deserialized (see the private RawPermissionRule below).
Ids are Drive’s own canonical ids, not paths — Drive objects have no
stable, unique path (names collide, files can have multiple legacy
parents), so identity is the id, exactly as the browser bridge’s
OriginAllowlist matches exact origin strings rather than URL
patterns.
A file_id rule is what makes a file shared by link or email
grantable at all (issue #1612): files.get returns only the parents
this account can see, so such a file arrives with none, and no
folder rule could ever apply to it.
Fields§
§folder_id: Option<String>The Drive folder id this rule matches, for a folder rule.
file_id: Option<String>The Drive file id this rule matches, for a file rule. Matched at
depth −1 against the target itself, before any ancestor walk — see
resolve_file_rule.
recursive: boolWhen true, this rule also matches every descendant of
folder_id, not just the folder itself (depth > 0 in the ancestor
chain). A non-recursive rule only ever matches at depth 0.
Meaningless — and rejected — on a file_id rule: a file has no
descendants.
allow: HashSet<DriveOperation>Operations explicitly permitted at this target.
deny: HashSet<DriveOperation>Operations explicitly refused at this target.
require_lease: boolWhether a content-mutating write matching this rule requires a
valid Drive write lease (ADR-0080
§1/§13) in addition to this gate’s own verdict. Defaults to true;
an operator sets it to false to relax the requirement for a
specific folder, which skips both the backup and the Touch ID
prompt (§13) — a rule that skipped only one of the two would either
surprise an operator who explicitly relaxed this, or ask for
consent to a guarantee it then doesn’t provide. Independent of
allow/deny: the lease is orthogonal to this gate, not another
operation in its vocabulary.
Implementations§
Source§impl FolderPermissionRule
impl FolderPermissionRule
Sourcepub fn recursive(self, recursive: bool) -> Self
pub fn recursive(self, recursive: bool) -> Self
Sets recursive, for builder-style construction in tests and
callers assembling rules programmatically.
Sourcepub fn requiring_lease(self, require_lease: bool) -> Self
pub fn requiring_lease(self, require_lease: bool) -> Self
Sets require_lease, for builder-style construction in tests and
callers assembling rules programmatically.
Sourcepub fn allowing(self, ops: impl IntoIterator<Item = DriveOperation>) -> Self
pub fn allowing(self, ops: impl IntoIterator<Item = DriveOperation>) -> Self
Sets the allow set.
Sourcepub fn denying(self, ops: impl IntoIterator<Item = DriveOperation>) -> Self
pub fn denying(self, ops: impl IntoIterator<Item = DriveOperation>) -> Self
Sets the deny set.
Trait Implementations§
Source§impl Clone for FolderPermissionRule
impl Clone for FolderPermissionRule
Source§impl Debug for FolderPermissionRule
impl Debug for FolderPermissionRule
Source§impl<'de> Deserialize<'de> for FolderPermissionRule
impl<'de> Deserialize<'de> for FolderPermissionRule
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>,
Auto Trait Implementations§
impl Freeze for FolderPermissionRule
impl RefUnwindSafe for FolderPermissionRule
impl Send for FolderPermissionRule
impl Sync for FolderPermissionRule
impl Unpin for FolderPermissionRule
impl UnsafeUnpin for FolderPermissionRule
impl UnwindSafe for FolderPermissionRule
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<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> ⓘ
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> ⓘ
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 more