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
impl PermissionsContainer
pub fn new( descriptor_parser: Arc<dyn PermissionDescriptorParser>, perms: Permissions, ) -> Self
pub fn deep_clone(&self) -> PermissionsContainer
pub fn allow_all(descriptor_parser: Arc<dyn PermissionDescriptorParser>) -> Self
pub fn create_child_permissions( &self, child_permissions_arg: ChildPermissionsArg, ) -> Result<PermissionsContainer, ChildPermissionError>
pub fn check_specifier( &self, specifier: &Url, kind: CheckSpecifierKind, ) -> Result<(), PermissionCheckError>
pub fn check_open<'a>( &self, path: Cow<'a, Path>, access_kind: OpenAccessKind, api_name: Option<&str>, ) -> Result<CheckedPath<'a>, PermissionCheckError>
Sourcepub fn check_open_blind<'a>(
&self,
path: Cow<'a, Path>,
access_kind: OpenAccessKind,
display: &str,
api_name: Option<&str>,
) -> Result<CheckedPath<'a>, PermissionCheckError>
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.
pub fn check_read_all(&self, api_name: &str) -> Result<(), PermissionCheckError>
pub fn query_read_all(&self) -> bool
pub fn check_write_all( &self, api_name: &str, ) -> Result<(), PermissionCheckError>
pub fn check_write_partial<'a>( &self, path: Cow<'a, Path>, api_name: &str, ) -> Result<CheckedPath<'a>, PermissionCheckError>
pub fn check_run( &self, cmd: &RunQueryDescriptor<'_>, api_name: &str, ) -> Result<(), PermissionCheckError>
pub fn check_run_all( &mut self, api_name: &str, ) -> Result<(), PermissionCheckError>
pub fn query_run_all(&mut self, api_name: &str) -> bool
pub fn check_sys( &self, kind: &str, api_name: &str, ) -> Result<(), PermissionCheckError>
pub fn check_env(&self, var: &str) -> Result<(), PermissionCheckError>
pub fn check_env_all(&self) -> Result<(), PermissionCheckError>
pub fn check_sys_all(&self) -> Result<(), PermissionCheckError>
pub fn check_ffi_all(&self) -> Result<(), PermissionCheckError>
pub fn check_has_all_permissions( &self, context_path: &Path, ) -> Result<(), PermissionCheckError>
Sourcepub fn check_special_file<'a>(
&self,
path: SpecialFilePathQueryDescriptor<'a>,
_api_name: Option<&str>,
) -> Result<CheckedPath<'a>, PermissionCheckError>
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.
pub fn check_net_url( &mut self, url: &Url, api_name: &str, ) -> Result<(), PermissionCheckError>
pub fn check_net<T: AsRef<str>>( &mut self, host: &(T, Option<u16>), api_name: &str, ) -> Result<(), PermissionCheckError>
pub fn check_net_vsock( &mut self, cid: u32, port: u32, api_name: &str, ) -> Result<(), PermissionCheckError>
pub fn check_ffi<'a>( &mut self, path: Cow<'a, Path>, ) -> Result<Cow<'a, Path>, PermissionCheckError>
pub fn check_ffi_partial_no_path(&mut self) -> Result<(), PermissionCheckError>
pub fn check_ffi_partial_with_path<'a>( &mut self, path: Cow<'a, Path>, ) -> Result<Cow<'a, Path>, PermissionCheckError>
pub fn query_read( &self, path: Option<&str>, ) -> Result<PermissionState, PathResolveError>
pub fn query_write( &self, path: Option<&str>, ) -> Result<PermissionState, PathResolveError>
pub fn query_net( &self, host: Option<&str>, ) -> Result<PermissionState, NetDescriptorParseError>
pub fn query_env(&self, var: Option<&str>) -> PermissionState
pub fn query_sys( &self, kind: Option<&str>, ) -> Result<PermissionState, SysDescriptorParseError>
pub fn query_run( &self, cmd: Option<&str>, ) -> Result<PermissionState, RunDescriptorParseError>
pub fn query_ffi( &self, path: Option<&str>, ) -> Result<PermissionState, PathResolveError>
pub fn query_import( &self, host: Option<&str>, ) -> Result<PermissionState, NetDescriptorParseError>
pub fn revoke_read( &self, path: Option<&str>, ) -> Result<PermissionState, PathResolveError>
pub fn revoke_write( &self, path: Option<&str>, ) -> Result<PermissionState, PathResolveError>
pub fn revoke_net( &self, host: Option<&str>, ) -> Result<PermissionState, NetDescriptorParseError>
pub fn revoke_env(&self, var: Option<&str>) -> PermissionState
pub fn revoke_sys( &self, kind: Option<&str>, ) -> Result<PermissionState, SysDescriptorParseError>
pub fn revoke_run( &self, cmd: Option<&str>, ) -> Result<PermissionState, RunDescriptorParseError>
pub fn revoke_ffi( &self, path: Option<&str>, ) -> Result<PermissionState, PathResolveError>
pub fn revoke_import( &self, host: Option<&str>, ) -> Result<PermissionState, NetDescriptorParseError>
pub fn request_read( &self, path: Option<&str>, ) -> Result<PermissionState, PathResolveError>
pub fn request_write( &self, path: Option<&str>, ) -> Result<PermissionState, PathResolveError>
pub fn request_net( &self, host: Option<&str>, ) -> Result<PermissionState, NetDescriptorParseError>
pub fn request_env(&self, var: Option<&str>) -> PermissionState
pub fn request_sys( &self, kind: Option<&str>, ) -> Result<PermissionState, SysDescriptorParseError>
pub fn request_run( &self, cmd: Option<&str>, ) -> Result<PermissionState, RunDescriptorParseError>
pub fn request_ffi( &self, path: Option<&str>, ) -> Result<PermissionState, PathResolveError>
pub fn request_import( &self, host: Option<&str>, ) -> Result<PermissionState, NetDescriptorParseError>
Trait Implementations§
Source§impl Clone for PermissionsContainer
impl Clone for PermissionsContainer
Source§fn clone(&self) -> PermissionsContainer
fn clone(&self) -> PermissionsContainer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PermissionsContainer
impl !RefUnwindSafe for PermissionsContainer
impl Send for PermissionsContainer
impl Sync for PermissionsContainer
impl Unpin for PermissionsContainer
impl !UnwindSafe for PermissionsContainer
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
Mutably borrows from an owned value. Read more