PermissionsContainer

Struct PermissionsContainer 

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

Wrapper struct for Permissions that can be shared across threads.

We need a way to have internal mutability for permissions as they might get passed to a future that will prompt the user for permission (and in such case might need to be mutated). Also for the Web Worker API we need a way to send permissions to a new thread.

Implementations§

Source§

impl PermissionsContainer

Source

pub fn new( descriptor_parser: Arc<dyn PermissionDescriptorParser>, perms: Permissions, ) -> Self

Source

pub fn deep_clone(&self) -> PermissionsContainer

Source

pub fn allow_all(descriptor_parser: Arc<dyn PermissionDescriptorParser>) -> Self

Source

pub fn create_child_permissions( &self, child_permissions_arg: ChildPermissionsArg, ) -> Result<PermissionsContainer, ChildPermissionError>

Source

pub fn check_specifier( &self, specifier: &Url, kind: CheckSpecifierKind, ) -> Result<(), PermissionCheckError>

Source

pub fn check_open<'a>( &self, path: Cow<'a, Path>, access_kind: OpenAccessKind, api_name: Option<&str>, ) -> Result<CheckedPath<'a>, PermissionCheckError>

Source

pub fn check_open_blind<'a>( &self, path: Cow<'a, Path>, access_kind: OpenAccessKind, display: &str, api_name: Option<&str>, ) -> Result<CheckedPath<'a>, PermissionCheckError>

As check_open(), but permission error messages will anonymize the path by replacing it with the given display.

Source

pub fn check_read_all(&self, api_name: &str) -> Result<(), PermissionCheckError>

Source

pub fn query_read_all(&self) -> bool

Source

pub fn check_write_all( &self, api_name: &str, ) -> Result<(), PermissionCheckError>

Source

pub fn check_write_partial<'a>( &self, path: Cow<'a, Path>, api_name: &str, ) -> Result<CheckedPath<'a>, PermissionCheckError>

Source

pub fn check_run( &self, cmd: &RunQueryDescriptor<'_>, api_name: &str, ) -> Result<(), PermissionCheckError>

Source

pub fn check_run_all( &mut self, api_name: &str, ) -> Result<(), PermissionCheckError>

Source

pub fn query_run_all(&mut self, api_name: &str) -> bool

Source

pub fn check_sys( &self, kind: &str, api_name: &str, ) -> Result<(), PermissionCheckError>

Source

pub fn check_env(&self, var: &str) -> Result<(), PermissionCheckError>

Source

pub fn check_env_all(&self) -> Result<(), PermissionCheckError>

Source

pub fn check_sys_all(&self) -> Result<(), PermissionCheckError>

Source

pub fn check_ffi_all(&self) -> Result<(), PermissionCheckError>

Source

pub fn check_has_all_permissions( &self, context_path: &Path, ) -> Result<(), PermissionCheckError>

Source

pub fn check_special_file<'a>( &self, path: SpecialFilePathQueryDescriptor<'a>, _api_name: Option<&str>, ) -> Result<CheckedPath<'a>, PermissionCheckError>

Checks special file access, returning the failed permission type if not successful.

Source

pub fn check_net_url( &mut self, url: &Url, api_name: &str, ) -> Result<(), PermissionCheckError>

Source

pub fn check_net<T: AsRef<str>>( &mut self, host: &(T, Option<u16>), api_name: &str, ) -> Result<(), PermissionCheckError>

Source

pub fn check_net_vsock( &mut self, cid: u32, port: u32, api_name: &str, ) -> Result<(), PermissionCheckError>

Source

pub fn check_ffi<'a>( &mut self, path: Cow<'a, Path>, ) -> Result<Cow<'a, Path>, PermissionCheckError>

Source

pub fn check_ffi_partial_no_path(&mut self) -> Result<(), PermissionCheckError>

Source

pub fn check_ffi_partial_with_path<'a>( &mut self, path: Cow<'a, Path>, ) -> Result<Cow<'a, Path>, PermissionCheckError>

Source

pub fn query_read( &self, path: Option<&str>, ) -> Result<PermissionState, PathResolveError>

Source

pub fn query_write( &self, path: Option<&str>, ) -> Result<PermissionState, PathResolveError>

Source

pub fn query_net( &self, host: Option<&str>, ) -> Result<PermissionState, NetDescriptorParseError>

Source

pub fn query_env(&self, var: Option<&str>) -> PermissionState

Source

pub fn query_sys( &self, kind: Option<&str>, ) -> Result<PermissionState, SysDescriptorParseError>

Source

pub fn query_run( &self, cmd: Option<&str>, ) -> Result<PermissionState, RunDescriptorParseError>

Source

pub fn query_ffi( &self, path: Option<&str>, ) -> Result<PermissionState, PathResolveError>

Source

pub fn query_import( &self, host: Option<&str>, ) -> Result<PermissionState, NetDescriptorParseError>

Source

pub fn revoke_read( &self, path: Option<&str>, ) -> Result<PermissionState, PathResolveError>

Source

pub fn revoke_write( &self, path: Option<&str>, ) -> Result<PermissionState, PathResolveError>

Source

pub fn revoke_net( &self, host: Option<&str>, ) -> Result<PermissionState, NetDescriptorParseError>

Source

pub fn revoke_env(&self, var: Option<&str>) -> PermissionState

Source

pub fn revoke_sys( &self, kind: Option<&str>, ) -> Result<PermissionState, SysDescriptorParseError>

Source

pub fn revoke_run( &self, cmd: Option<&str>, ) -> Result<PermissionState, RunDescriptorParseError>

Source

pub fn revoke_ffi( &self, path: Option<&str>, ) -> Result<PermissionState, PathResolveError>

Source

pub fn revoke_import( &self, host: Option<&str>, ) -> Result<PermissionState, NetDescriptorParseError>

Source

pub fn request_read( &self, path: Option<&str>, ) -> Result<PermissionState, PathResolveError>

Source

pub fn request_write( &self, path: Option<&str>, ) -> Result<PermissionState, PathResolveError>

Source

pub fn request_net( &self, host: Option<&str>, ) -> Result<PermissionState, NetDescriptorParseError>

Source

pub fn request_env(&self, var: Option<&str>) -> PermissionState

Source

pub fn request_sys( &self, kind: Option<&str>, ) -> Result<PermissionState, SysDescriptorParseError>

Source

pub fn request_run( &self, cmd: Option<&str>, ) -> Result<PermissionState, RunDescriptorParseError>

Source

pub fn request_ffi( &self, path: Option<&str>, ) -> Result<PermissionState, PathResolveError>

Source

pub fn request_import( &self, host: Option<&str>, ) -> Result<PermissionState, NetDescriptorParseError>

Trait Implementations§

Source§

impl Clone for PermissionsContainer

Source§

fn clone(&self) -> PermissionsContainer

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for PermissionsContainer

Source§

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

Formats the value using the given formatter. Read more

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T