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.