Skip to main content

AccessPolicy

Trait AccessPolicy 

Source
pub trait AccessPolicy {
    // Required methods
    fn markers(&self) -> PermissionMarkers;
    fn can_read(
        &mut self,
        data: &mut dyn NamedTypeLinks,
        subject: u32,
        link: &Link,
    ) -> bool;
    fn can_write(
        &mut self,
        data: &mut dyn NamedTypeLinks,
        subject: u32,
        link: &Link,
    ) -> bool;
    fn can_create(
        &mut self,
        data: &mut dyn NamedTypeLinks,
        subject: u32,
    ) -> bool;

    // Provided method
    fn can_reference(
        &mut self,
        _data: &mut dyn NamedTypeLinks,
        _subject: u32,
        _link: &Link,
    ) -> bool { ... }
}
Expand description

Who may read, write and refer to what.

A subject is a link address; the null link (0) is a guest, which no rule but one for Anything matches. A link is given as (index, source, target), so a link that is not stored yet, or not any more, can be asked about too. data is the store the links are in, for their types.

Required Methods§

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.

Provided Methods§

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.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<P: AccessPolicy + ?Sized> AccessPolicy for &mut P

Source§

fn markers(&self) -> PermissionMarkers

Source§

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

Source§

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

Source§

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

Source§

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

Source§

impl<P: AccessPolicy + ?Sized> AccessPolicy for Box<P>

Source§

fn markers(&self) -> PermissionMarkers

Source§

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

Source§

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

Source§

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

Source§

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

Implementors§