InternalTrait
Fully qualified path: openzeppelin_access::accesscontrol::accesscontrol::AccessControlComponent::InternalTrait
pub trait InternalTrait<
TContractState,
+HasComponent<TContractState>,
impl SRC5: HasComponent<TContractState>,
+Drop<TContractState>,
>
Trait functions
initializer
Initializes the contract by registering the IAccessControl interface ID.
Fully qualified path: openzeppelin_access::accesscontrol::accesscontrol::AccessControlComponent::InternalTrait::initializer
fn initializer(ref self: ComponentState<TContractState>)
assert_only_role
Validates that the caller can act as the given role. Otherwise it panics.
Fully qualified path: openzeppelin_access::accesscontrol::accesscontrol::AccessControlComponent::InternalTrait::assert_only_role
fn assert_only_role(self: @ComponentState<TContractState>, role: felt252)
is_role_effective
Returns whether the account can act as the given role.
The account can act as the role if it is active and the effective_from time is before
or equal to the current time.
NOTE: If the effective_from timepoint is 0, the role is effective immediately.
This is backwards compatible with implementations that didn’t use delays but
a single boolean flag.
Fully qualified path: openzeppelin_access::accesscontrol::accesscontrol::AccessControlComponent::InternalTrait::is_role_effective
fn is_role_effective(
self: @ComponentState<TContractState>, role: felt252, account: ContractAddress,
) -> bool
resolve_role_status
Returns the account’s status for the given role.
The possible statuses are:
NotGranted: the role has not been granted to the account.Delayed: The role has been granted to the account but is not yet active due to a time delay.Effective: the role has been granted to the account and is currently active.
Fully qualified path: openzeppelin_access::accesscontrol::accesscontrol::AccessControlComponent::InternalTrait::resolve_role_status
fn resolve_role_status(
self: @ComponentState<TContractState>, role: felt252, account: ContractAddress,
) -> RoleStatus
is_role_granted
Returns whether the account has the given role granted.
NOTE: The account may not be able to act as the role yet, if a delay was set and has not
passed yet. Use is_role_effective to check if the account can act as the role.
Fully qualified path: openzeppelin_access::accesscontrol::accesscontrol::AccessControlComponent::InternalTrait::is_role_granted
fn is_role_granted(
self: @ComponentState<TContractState>, role: felt252, account: ContractAddress,
) -> bool
set_role_admin
Sets admin_role as role’s admin role.
Internal function without access restriction.
Emits a RoleAdminChanged event.
Fully qualified path: openzeppelin_access::accesscontrol::accesscontrol::AccessControlComponent::InternalTrait::set_role_admin
fn set_role_admin(ref self: ComponentState<TContractState>, role: felt252, admin_role: felt252)
_grant_role
Attempts to grant role to account. The function does nothing if role is already
effective for account. If role has been granted to account, but is not yet active
due to a time delay, the delay is removed and role becomes effective immediately.
Internal function without access restriction.
May emit a RoleGranted event.
Fully qualified path: openzeppelin_access::accesscontrol::accesscontrol::AccessControlComponent::InternalTrait::_grant_role
fn _grant_role(ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress)
_grant_role_with_delay
Attempts to grant role to account with the specified activation delay.
The role will become effective after the given delay has passed. If the role is already
active (Effective) for the account, the function will panic. If the role has been
granted but is not yet active (being in the Delayed state), the existing delay will be
overwritten with the new delay.
Internal function without access restriction.
Requirements:
- delay must be greater than 0.
- the
rolemust not be already effective foraccount.
May emit a RoleGrantedWithDelay event.
Fully qualified path: openzeppelin_access::accesscontrol::accesscontrol::AccessControlComponent::InternalTrait::_grant_role_with_delay
fn _grant_role_with_delay(
ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress, delay: u64,
)
_revoke_role
Attempts to revoke role from account.
Internal function without access restriction.
May emit a RoleRevoked event.
Fully qualified path: openzeppelin_access::accesscontrol::accesscontrol::AccessControlComponent::InternalTrait::_revoke_role
fn _revoke_role(ref self: ComponentState<TContractState>, role: felt252, account: ContractAddress)