Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

AccessControlComponent

AccessControl Component

The AccessControl component enables role-based access control mechanisms. This is a lightweight implementation that doesn’t support on-chain enumeration of role members, though role membership can be tracked off-chain through contract events.

Roles can be granted and revoked dynamically via grant_role and revoke_role. Each role has an associated admin role that controls who can grant and revoke it. By default, all roles use DEFAULT_ADMIN_ROLE as their admin role. Accounts can also renounce roles they have been granted by using renounce_role.

More complex role hierarchies can be created using set_role_admin.

WARNING: The DEFAULT_ADMIN_ROLE is its own admin, meaning it can grant and revoke itself. Extra precautions should be taken to secure accounts with this role.

Fully qualified path: openzeppelin_access::accesscontrol::accesscontrol::AccessControlComponent

Modules

Constants

Free functions

Structs

Storage
RoleGrantedEmitted when account is granted role . sender is the account that originated the contract call, an account with the admin role or the deployer address if _grant_role
RoleGrantedWithDelayEmitted when account is granted role with a delay. sender is the account that originated the contract call, an account with the admin role or the deployer address if _grant_role_with_delay
RoleRevokedEmitted when role is revoked for account . sender is the account that originated the contract call:…
RoleAdminChangedEmitted when new_admin_role is set as role ’s admin role, replacing previous_admin_role DEFAULT_ADMIN_ROLE is the starting admin for all roles, despite RoleAdminChanged
ComponentState

Enums

Event

Traits