pub struct DummyAccess<Address: AsRef<[u8]> + Zero + Default + PartialEq> { /* private fields */ }
Trait Implementations§
Source§impl<Address> AccessControlRegistry for DummyAccess<Address>
impl<Address> AccessControlRegistry for DummyAccess<Address>
Source§fn has_role(&self, _role: &Bytes32, _who: &Self::Address) -> bool
fn has_role(&self, _role: &Bytes32, _who: &Self::Address) -> bool
Checks if user has a particular role
role
The role to check
who
The address to checkSource§fn grant_role(
&mut self,
_role: &Bytes32,
_who: &Self::Address,
) -> Result<(), Error>
fn grant_role( &mut self, _role: &Bytes32, _who: &Self::Address, ) -> Result<(), Error>
Grant role for the user
role
The role to grant
who
The address to grant roleSource§fn get_role_admin(&self, _role: &Bytes32) -> Option<Bytes32>
fn get_role_admin(&self, _role: &Bytes32) -> Option<Bytes32>
Get the admin role of role
role
The role to checkSource§fn set_role_admin(
&mut self,
_role: &Bytes32,
_role_admin: Bytes32,
) -> Result<(), Error>
fn set_role_admin( &mut self, _role: &Bytes32, _role_admin: Bytes32, ) -> Result<(), Error>
Set the role admin for a role
role
The role to grant
role_admin
The role adminSource§fn renounce_role(
&mut self,
_role: &Bytes32,
_account: &Self::Address,
) -> Result<(), Error>
fn renounce_role( &mut self, _role: &Bytes32, _account: &Self::Address, ) -> Result<(), Error>
Called by the account to renounce the role
Override to disallow managers to renounce their root roles.
role
Role to be renounced
account
Account to renounce the roleSource§fn revoke_role(
&mut self,
_role: &Bytes32,
_account: &Self::Address,
) -> Result<(), Error>
fn revoke_role( &mut self, _role: &Bytes32, _account: &Self::Address, ) -> Result<(), Error>
Called by the role admin to renounce the role
Override to disallow managers to renounce their root roles.
role
Role to be renounced
account
Account to renounce the roleSource§const DEFAULT_ADMIN_ROLE: Bytes32 = _
const DEFAULT_ADMIN_ROLE: Bytes32 = _
Default admin role, align with Openzepplin’s definition
const NAME_SETTER_ROLE_DESCRIPTION: &'static str = "Name setter"
const UNLIMITED_READER_ROLE_DESCRIPTION: &'static str = "Unlimited reader"
Source§fn find_static_role(&self, role: StaticRole) -> Bytes32
fn find_static_role(&self, role: StaticRole) -> Bytes32
Find the role by its name. Not in the original solidity contract
Just for making it work in Rust
Source§fn only_role(
&self,
role: &Bytes32,
msg_sender: &Self::Address,
) -> Result<(), Error>
fn only_role( &self, role: &Bytes32, msg_sender: &Self::Address, ) -> Result<(), Error>
Checks that an account has a specific role. Reverts
with a standardized message including the required role.
role
The role to check
msg_sender
The address to checkSource§fn initialize_manager(&mut self, manager: &Self::Address) -> Result<(), Error>
fn initialize_manager(&mut self, manager: &Self::Address) -> Result<(), Error>
Initializes the manager by initializing its root role and
granting it to them
Anyone can initialize a manager. An uninitialized manager
attempting to initialize a role will be initialized automatically.
Once a manager is initialized, subsequent initializations have no
effect.
manager
Manager address to be initializedSource§fn initialize_role_and_grant_to_sender(
&mut self,
admin_role: Bytes32,
description: String,
msg_sender: &Self::Address,
) -> Result<Bytes32, Error>
fn initialize_role_and_grant_to_sender( &mut self, admin_role: Bytes32, description: String, msg_sender: &Self::Address, ) -> Result<Bytes32, Error>
Initializes a role by setting its admin role and grants it to
the sender
If the sender should not have the initialized role, they should
explicitly renounce it after initializing it.
Once a role is initialized, subsequent initializations have no effect
other than granting the role to the sender.
The sender must be a member of
admin_role
. admin_role
value is not
validated because the sender cannot have the bytes32(0)
role.
If the sender is an uninitialized manager that is initializing a role
directly under their root role, manager initialization will happen
automatically, which will grant the sender admin_role
and allow them
to initialize the role.
admin_role
Admin role to be assigned to the initialized role
description
Human-readable description of the initialized role
msg_sender
The message sender addressSource§fn derive_admin_role(&self, manager: &Self::Address) -> Bytes32
fn derive_admin_role(&self, manager: &Self::Address) -> Bytes32
Derives the admin role of the manager
manager
Manager addressSource§fn derive_root_role(&self, manager: &Self::Address) -> Bytes32
fn derive_root_role(&self, manager: &Self::Address) -> Bytes32
Derives the root role of the manager
manager
Manager addressSource§impl<Address> AccessControlRegistryAdminnedWithManager for DummyAccess<Address>
impl<Address> AccessControlRegistryAdminnedWithManager for DummyAccess<Address>
type Address = Address
Source§fn admin_role_description(&self) -> String
fn admin_role_description(&self) -> String
Admin role description
Source§fn admin_role_description_hash(&self) -> Bytes32
fn admin_role_description_hash(&self) -> Bytes32
Admin role description hash
Source§fn admin_role(&self) -> Bytes32
fn admin_role(&self) -> Bytes32
Admin role
Auto Trait Implementations§
impl<Address> Freeze for DummyAccess<Address>where
Address: Freeze,
impl<Address> RefUnwindSafe for DummyAccess<Address>where
Address: RefUnwindSafe,
impl<Address> Send for DummyAccess<Address>where
Address: Send,
impl<Address> Sync for DummyAccess<Address>where
Address: Sync,
impl<Address> Unpin for DummyAccess<Address>where
Address: Unpin,
impl<Address> UnwindSafe for DummyAccess<Address>where
Address: UnwindSafe,
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