Access Control Revoke Facet
Revokes roles from accounts within a diamond
- Revokes roles from accounts using diamond storage.
- Emits
RoleRevokedevent upon successful revocation. - Reverts with
AccessControlUnauthorizedAccountif the caller lacks administrative privileges for the role. - Exports facet selectors via
exportSelectors.
Overview
This facet provides functionality to revoke roles from specific accounts within a Compose diamond. It interacts with shared diamond storage to manage role assignments. Developers integrate this facet to enable dynamic permission management, ensuring only authorized entities can perform certain actions.
Storage
AccessControlStorage
State Variables
| Property | Type | Description |
|---|---|---|
STORAGE_POSITION | bytes32 | Diamond storage slot position for this module (Value: keccak256("compose.accesscontrol")) |
Functions
revokeRole
Revokes a role from an account. Emits a RoleRevoked event. Reverts with AccessControlUnauthorizedAccount If the caller is not the admin of the role.
Parameters:
| Property | Type | Description |
|---|---|---|
_role | bytes32 | The role to revoke. |
_account | address | The account to revoke the role from. |
exportSelectors
Exports the selectors that are exposed by the facet.
Returns:
| Property | Type | Description |
|---|---|---|
- | bytes | Selectors that are exported by the facet. |
Events
Errors
Best Practices
- Enforce access control on the
revokeRolefunction to ensure only authorized callers can revoke roles. - Ensure the
AccessControlRevokeModis properly integrated and initialized to manage role revocation logic. - Verify that the
AccessControlStoragestruct in diamond storage is compatible before upgrading or adding this facet.
Security Considerations
The revokeRole function is protected by an access control mechanism, reverting with AccessControlUnauthorizedAccount if the caller is not the administrator of the specified role. Follow standard Solidity security practices for input validation and state management. Ensure proper initialization of roles and accounts before attempting revocation.