Skip to main content

Acl

Struct Acl 

Source
#[non_exhaustive]
pub struct Acl { pub entries: Vec<Entry>, pub protected: bool, pub mode: Mode, }
Expand description

An access control list.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§entries: Vec<Entry>

The entries, in order.

§protected: bool

Whether it takes nothing from a parent (Acl::inherited_by): a protected DACL.

§mode: Mode

How the entries combine. Default deny_overrides.

Implementations§

Source§

impl Acl

Source

pub fn validate( &self, schema: &RightsSchema, options: &Options, ) -> Result<(), AclError>

Checks this ACL against schema and limits without evaluating it.

§Errors

As check.

Source

pub fn check( &self, context: &Context<'_>, wanted: &Rights, ) -> Result<Decision, AclError>

Whether the requester in context holds every right in wanted on an item with this ACL. Entries marked inherit_only do not apply here. An applicable entry naming a cancelling name refuses everything, in every mode.

An empty wanted is allowed: nothing was asked for.

§Errors

The ACL is not usable with this schema and these options: more entries than Limits::entries, a name the schema lacks, a deny where the mode has none, a principal the mode does not take.

Source§

impl Acl

Source

pub fn new(mode: Mode) -> Self

An empty ACL in mode: it grants nothing.

Source

pub fn entry(self, entry: Entry) -> Self

Adds an entry after the others.

Source

pub fn protected(self, protected: bool) -> Self

Sets whether it takes nothing from a parent.

Source

pub fn canonicalize(&mut self)

Sorts the entries into Windows’ canonical order: explicit denies, explicit allows, then inherited entries in the order they were. The sort is stable.

Source

pub fn non_defaults(&self) -> Vec<NonDefault>

What this ACL grants more widely than the default does, for the caller to report or refuse: every allow entry naming Everyone.

Source§

impl Acl

Source

pub fn inherited_by( &self, child: Child, explicit: &Acl, creator: Option<&Subject>, ) -> Acl

The ACL a child of an item with this ACL gets: explicit’s own entries first, then the copies this ACL passes down, marked inherited, in explicit’s mode. A protected explicit takes nothing and comes back as it is; entries explicit had inherited before are replaced.

The copies follow Windows’ table (items is OI, containers CI):

parent entryto an itemto a container
itemsapplies, no flagsinherit-only, keeps items
containersnothingapplies, keeps containers
bothapplies, no flagsapplies, keeps both
with no_propagateapplies, no flags (if items)applies with no flags (if containers), else nothing

A parent entry that is inherit_only is copied the same way; the copy applies. With a creator, an Owner entry (Windows CREATOR OWNER) is copied as an entry for the creator, and a container also keeps an inherit-only Owner entry to pass on. Nothing is walked at check time: store the result.

Trait Implementations§

Source§

impl Clone for Acl

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Acl

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Acl

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Describe for Acl

Source§

type Fill = __Fill

The partly filled state of this type: what Partial holds.
Source§

fn description() -> Description

What this type is.
§

const OPTIONAL: bool = false

The type is Option<_>: leaving a field of it out is a value of its own, so it is never required.
§

const LEAF: bool = false

The type is one text: a [Leaf], or an untagged enum whose arms all are. An untagged enum counts the arms that are not, and holds at most one.
Source§

impl Eq for Acl

Source§

impl Extend<Entry> for Acl

Source§

fn extend<I: IntoIterator<Item = Entry>>(&mut self, entries: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: T)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl Fields for Acl

Source§

impl Inspect for Acl

Source§

fn at(&self, __at: &[Segment]) -> Option<Datum>

The leaf at at, or None.
Source§

fn entries(&self, __at: &[Segment]) -> Option<Entries>

The structure at at, or None.
Source§

impl PartialEq for Acl

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Acl

Auto Trait Implementations§

§

impl Freeze for Acl

§

impl RefUnwindSafe for Acl

§

impl Send for Acl

§

impl Sync for Acl

§

impl Unpin for Acl

§

impl UnsafeUnpin for Acl

§

impl UnwindSafe for Acl

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.