You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
730 B
38 lines
730 B
pragma solidity ^0.4.24;
|
|
|
|
|
|
/**
|
|
* @title Roles
|
|
* @dev Library for managing addresses assigned to a Role.
|
|
*/
|
|
library Roles {
|
|
struct Role {
|
|
mapping (address => bool) bearer;
|
|
}
|
|
|
|
/**
|
|
* @dev give an account access to this role
|
|
*/
|
|
function add(Role storage _role, address _account) internal {
|
|
_role.bearer[_account] = true;
|
|
}
|
|
|
|
/**
|
|
* @dev remove an account's access to this role
|
|
*/
|
|
function remove(Role storage _role, address _account) internal {
|
|
_role.bearer[_account] = false;
|
|
}
|
|
|
|
/**
|
|
* @dev check if an account has this role
|
|
* @return bool
|
|
*/
|
|
function has(Role storage _role, address _account)
|
|
internal
|
|
view
|
|
returns (bool)
|
|
{
|
|
return _role.bearer[_account];
|
|
}
|
|
}
|
|
|