pub struct UnseqMap { /* private fields */ }Expand description
Map that is unpublished on the network. This data can only be fetched by the owner or
those in the permissions fields with Permission::Read access.
Implementations§
Source§impl UnseqData
impl UnseqData
Sourcepub fn permissions(&self) -> BTreeMap<PublicKey, PermissionSet>
pub fn permissions(&self) -> BTreeMap<PublicKey, PermissionSet>
Gets a complete list of permissions.
Sourcepub fn user_permissions(&self, user: PublicKey) -> Result<&PermissionSet>
pub fn user_permissions(&self, user: PublicKey) -> Result<&PermissionSet>
Gets the permissions for the provided user.
Sourcepub fn check_is_owner(&self, requester: PublicKey) -> Result<()>
pub fn check_is_owner(&self, requester: PublicKey) -> Result<()>
Checks if the provided user is an owner.
Returns Ok(()) on success and Err(Error::AccessDenied) if the user is not an
owner.
Sourcepub fn check_permissions(
&self,
action: Action,
requester: PublicKey,
) -> Result<()>
pub fn check_permissions( &self, action: Action, requester: PublicKey, ) -> Result<()>
Checks permissions for given action for the provided user.
Returns Err(Error::AccessDenied) if the permission check has failed.
Sourcepub fn set_user_permissions(
&mut self,
user: PublicKey,
permissions: PermissionSet,
version: u64,
) -> Result<()>
pub fn set_user_permissions( &mut self, user: PublicKey, permissions: PermissionSet, version: u64, ) -> Result<()>
Inserts or updates permissions for the provided user.
Requires the new version of the Map fields. If it does not match the
current version + 1, an error will be returned.
Sourcepub fn del_user_permissions(
&mut self,
user: PublicKey,
version: u64,
) -> Result<()>
pub fn del_user_permissions( &mut self, user: PublicKey, version: u64, ) -> Result<()>
Deletes permissions for the provided user.
Requires the new version of the Map fields. If it does not match the
current version + 1, an error will be returned.
Sourcepub fn del_user_permissions_without_validation(
&mut self,
user: PublicKey,
version: u64,
) -> bool
pub fn del_user_permissions_without_validation( &mut self, user: PublicKey, version: u64, ) -> bool
Deletes user permissions without performing any validation.
Requires the new version of the Map fields. If it does not match the
current version + 1, an error will be returned.
Sourcepub fn change_owner(&mut self, new_owner: PublicKey, version: u64) -> Result<()>
pub fn change_owner(&mut self, new_owner: PublicKey, version: u64) -> Result<()>
Changes the owner.
Requires the new version of the Map fields. If it does not match the
current version + 1, an error will be returned.
Sourcepub fn change_owner_without_validation(
&mut self,
new_owner: PublicKey,
version: u64,
) -> bool
pub fn change_owner_without_validation( &mut self, new_owner: PublicKey, version: u64, ) -> bool
Changes the owner without performing any validation.
Requires the new version of the Map fields. If it does not match the
current version + 1, an error will be returned.
Sourcepub fn is_action_allowed(&self, requester: &PublicKey, action: Action) -> bool
pub fn is_action_allowed(&self, requester: &PublicKey, action: Action) -> bool
Returns true if action is allowed for the provided user.
Source§impl UnseqData
impl UnseqData
Sourcepub fn new_with_data(
name: XorName,
tag: u64,
data: UnseqEntries,
permissions: BTreeMap<PublicKey, PermissionSet>,
owner: PublicKey,
) -> Self
pub fn new_with_data( name: XorName, tag: u64, data: UnseqEntries, permissions: BTreeMap<PublicKey, PermissionSet>, owner: PublicKey, ) -> Self
Creates a new unsequenced Map with entries and permissions.
Sourcepub fn entries(&self) -> &UnseqEntries
pub fn entries(&self) -> &UnseqEntries
Returns all entries.
Sourcepub fn take_entries(&mut self) -> UnseqEntries
pub fn take_entries(&mut self) -> UnseqEntries
Removes and returns all entries.
Sourcepub fn mutate_entries(
&mut self,
actions: UnseqEntryActions,
requester: PublicKey,
) -> Result<()>
pub fn mutate_entries( &mut self, actions: UnseqEntryActions, requester: PublicKey, ) -> Result<()>
Mutates entries based on actions for the provided user.
Returns Err(InvalidEntryActions) if the mutation parameters are invalid.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for UnseqData
impl<'de> Deserialize<'de> for UnseqData
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Ord for UnseqData
impl Ord for UnseqData
Source§impl PartialOrd for UnseqData
impl PartialOrd for UnseqData
impl Eq for UnseqData
impl StructuralPartialEq for UnseqData
Auto Trait Implementations§
impl Freeze for UnseqData
impl RefUnwindSafe for UnseqData
impl Send for UnseqData
impl Sync for UnseqData
impl Unpin for UnseqData
impl UnwindSafe for UnseqData
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more