pub struct SeqMap { /* 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 SeqData
impl SeqData
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 SeqData
Implements functions for sequenced Map.
impl SeqData
Implements functions for sequenced Map.
Sourcepub fn new_with_data(
name: XorName,
tag: u64,
data: SeqEntries,
permissions: BTreeMap<PublicKey, PermissionSet>,
owner: PublicKey,
) -> Self
pub fn new_with_data( name: XorName, tag: u64, data: SeqEntries, permissions: BTreeMap<PublicKey, PermissionSet>, owner: PublicKey, ) -> Self
Creates a new sequenced Map with entries and permissions.
Sourcepub fn entries(&self) -> &SeqEntries
pub fn entries(&self) -> &SeqEntries
Returns all entries
Sourcepub fn take_entries(&mut self) -> SeqEntries
pub fn take_entries(&mut self) -> SeqEntries
Removes and returns all entries
Sourcepub fn mutate_entries(
&mut self,
actions: SeqEntryActions,
requester: PublicKey,
) -> Result<()>
pub fn mutate_entries( &mut self, actions: SeqEntryActions, requester: PublicKey, ) -> Result<()>
Mutates entries (key + value pairs) in bulk.
Returns Err(InvalidEntryActions) if the mutation parameters are invalid.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SeqData
impl<'de> Deserialize<'de> for SeqData
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 SeqData
impl Ord for SeqData
Source§impl PartialOrd for SeqData
impl PartialOrd for SeqData
impl Eq for SeqData
impl StructuralPartialEq for SeqData
Auto Trait Implementations§
impl Freeze for SeqData
impl RefUnwindSafe for SeqData
impl Send for SeqData
impl Sync for SeqData
impl Unpin for SeqData
impl UnwindSafe for SeqData
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