Access Control Temporal Revoke Module
Revoke temporal roles with admin authorization
- Provides an
internalfunctionrevokeTemporalRolefor revoking temporal roles. - Enforces authorization, allowing only the role's admin to revoke.
- Emits a
TemporalRoleRevokedevent upon successful revocation. - Operates using the diamond storage pattern for shared state management.
This module provides internal functions for use in your custom facets. Import it to access shared logic and storage.
Overview
This module provides functions to revoke temporal roles, ensuring that only authorized administrators can perform this action. It integrates with diamond storage to manage role revocation state, making changes immediately visible to all facets accessing the same storage. Use this module to implement time-limited access control within your diamond.
Storage
AccessControlStorage
Storage struct for AccessControl (reused struct definition). Must match the struct definition in AccessControlDataFacet. storage-location: erc8042:compose.accesscontrol
AccessControlTemporalStorage
Storage struct for AccessControlTemporal. storage-location: erc8042:compose.accesscontrol.temporal
State Variables
| Property | Type | Description |
|---|---|---|
ACCESS_CONTROL_STORAGE_POSITION | bytes32 | Diamond storage slot position for this module (Value: keccak256("compose.accesscontrol")) |
TEMPORAL_STORAGE_POSITION | bytes32 | Diamond storage slot position for this module (Value: keccak256("compose.accesscontrol.temporal")) |
Functions
getAccessControlStorage
Returns the storage for AccessControl.
Returns:
| Property | Type | Description |
|---|---|---|
s | AccessControlStorage | The AccessControl storage struct. |
getStorage
Returns the storage for AccessControlTemporal.
Returns:
| Property | Type | Description |
|---|---|---|
s | AccessControlTemporalStorage | The AccessControlTemporal storage struct. |
revokeTemporalRole
Revokes a temporal role from an account. Only the admin of the role can revoke it. Emits a {TemporalRoleRevoked} 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. |
Events
Errors
Best Practices
- Ensure the caller possesses the necessary administrative privileges for the role before invoking
revokeTemporalRole. - Verify that the
AccessControlTemporalRevokeModhas been correctly initialized with its diamond storage address. - Handle the
AccessControlUnauthorizedAccounterror to gracefully manage unauthorized revocation attempts.
Integration Notes
This module operates on shared diamond storage, specifically utilizing the ACCESS_CONTROL_STORAGE_POSITION (keccak256("compose.accesscontrol")) for its AccessControlStorage and AccessControlTemporalStorage structures. All modifications made via revokeTemporalRole are immediately reflected in the diamond's storage and are visible to any other facet that reads from these storage locations. The module's functions are internal, implying they are intended to be called by other facets within the same diamond.