-
Notifications
You must be signed in to change notification settings - Fork 26
Role Authorizer
File: RoleAuthorizer.sol
- Core roles for a orchestrator are
OWNERandMANAGER. - They correspond to uint8(0) and uint(1) respectively.
- Orchestrator owner can register more global roles using numbers after uint(1). They'll need to go through the DEFAULT_ADMIN_ROLE for this.
modifier onlyModule(address module)Verifies that the caller is an active module
modifier onlySelfManaged()Verifies that the calling module has turned on self-management
modifier notLastOwner(bytes32 role)Verifies that the owner being removed is not the last one.
function isAuthorized(uint8 role, address who)
external
view
returns (bool);Overloads {isAuthorized} for a Module to ask whether an address holds the required role to execute the current transaction. If the role is not self-managed, it will default to the orchestrator roles. If not, it will use the calling address to generate the role ID. Therefore, for checking on anything other than itself, hasRole() should be used.
- uint8 role: The identifier of the role we want to check
- address who: The address on which to perform the check
- bool: Is the address
whoauthorized for the rolerole.
function init(
IOrchestrator orchestrator_,
Metadata memory metadata,
bytes memory configData
) external override initializerA function that helps initialize a module.
- IOrchestrator orchestrator_: {IOrchestrator} instance of the orchestrator that uses this role authorizer.
- Metadata metadata: Metadata about the RoleAuthorizer module
- bytes configData: Custom data that is useful for the initialization of this module.
function generateRoleId(address module, uint8 role)
external
returns (bytes32);Helper function to generate a bytes32 role hash for a module role.
- address module: The address of the module to generate hash for
- uint8 role: The ID number of the role to generate hash for
- bytes32: The ID for the new role in the form of
bytes32.
function toggleModuleSelfManagement() external;Toggles if a Module self-manages its roles or defaults to the orchestrator's roles.
function grantRoleFromModule(uint8 role, address target) external;Used by a Module to grant a role to a user.
- uint8 role: The identifier of the role to grant
- address target: The address to which to grant the role
function revokeRoleFromModule(uint8 role, address target) external;Used by a Module to revoke a role from a user.
- uint8 role: The identifier of the role to revoke
- address target: The address to revoke the role from.
function transferAdminRole(bytes32 roleId, bytes32 newAdmin) external;Transfer the admin rights to a given role.
- bytes32 roleId: The role on which to peform the admin transfer
- bytes32 newAdmin: The new role to which to transfer admin access to
function burnAdminRole(uint8 role) external;Irreversibly burns the admin of a given role. The module itself can still grant and revoke it's own roles. This only burns third-party access to the role.
- uint8 role: The role to remove admin access from