Skip to main content

PermissionPolicy

Struct PermissionPolicy 

Source
pub struct PermissionPolicy { /* private fields */ }
Expand description

Permissions stored as links; see the module documentation.

Implementations§

Source§

impl PermissionPolicy

Source

pub fn new( markers: PermissionMarkers, types: TypeMarkers, rules: Option<Box<dyn NamedTypeLinks>>, ) -> Self

The policy of the rules marked by markers, with the types of types: in the data when rules is None, else in rules.

Source

pub fn in_data<L: NamedTypeLinks + ?Sized>(data: &mut L) -> Result<Self>

The policy of the rules in data, whose points named Type, Extends, AllowRead, AllowWrite, Anything and AllowReference are created when missing.

Source

pub fn with_rules<L: NamedTypeLinks + ?Sized>( data: &mut L, rules: Box<dyn NamedTypeLinks>, ) -> Result<Self>

The policy of the rules in rules, a store of their own, over data, whose points are created when missing as by in_data.

Source

pub fn types(&self) -> TypeMarkers

The type markers of the data.

Source

pub fn rules_mut(&mut self) -> Option<&mut (dyn NamedTypeLinks + 'static)>

The store of the rules when they are kept apart from the data.

Source

pub fn rules_of<'a>( &'a mut self, data: &'a mut dyn NamedTypeLinks, ) -> &'a mut dyn NamedTypeLinks

The store of the rules: data itself, or the rules’ own store.

Source

pub fn granted( &mut self, data: &mut dyn NamedTypeLinks, marker: u32, ) -> Vec<(u32, u32)>

The rules (Subject Object) that marker marks, in the order of their marks.

Source

pub fn allows( &mut self, data: &mut dyn NamedTypeLinks, marker: u32, subject: u32, link: &Link, ) -> bool

Whether a rule of marker lets subject at link.

Source

pub fn allow<L: NamedTypeLinks + ?Sized>( rules: &mut L, markers: PermissionMarkers, access: PermissionAccess, subject: u32, object: u32, ) -> Result<u32>

Writes a rule into rules: subject may access the links of object. The rule is the pair (subject object) marked by (marker rule); returns the pair.

Source

pub fn parse_access(access: &str) -> Result<PermissionAccess>

Parses read, write or reference.

Trait Implementations§

Source§

impl AccessPolicy for PermissionPolicy

Source§

fn markers(&self) -> PermissionMarkers

The markers the rules are made of.
Source§

fn can_read( &mut self, data: &mut dyn NamedTypeLinks, subject: u32, link: &Link, ) -> bool

Whether subject may read link; writing allows reading.
Source§

fn can_write( &mut self, data: &mut dyn NamedTypeLinks, subject: u32, link: &Link, ) -> bool

Whether subject may write link, as it is or as it will be.
Source§

fn can_create(&mut self, data: &mut dyn NamedTypeLinks, subject: u32) -> bool

Whether subject may write anything at all, and so create links.
Source§

fn can_reference( &mut self, data: &mut dyn NamedTypeLinks, subject: u32, link: &Link, ) -> bool

Whether subject may refer to link although it need not read it. A missing address is asked about as an untyped link. A policy without this right allows references to readable links only.

Auto Trait Implementations§

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> 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> Same for T

Source§

type Output = T

Should always be Self
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.