Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
75 lines (63 sloc) 4.2 KB
pragma solidity >=0.5.8;
import "./Address.sol";
import "./EternalStorage.sol";
import "./IACL.sol";
contract AccessControl is EternalStorage {
using Address for address;
// BEGIN: Generated by script outputRoleConstants.js
// DO NOT MANUALLY MODIFY THESE VALUES!
bytes32 constant public ROLE_ASSET_MANAGER = 0xb22c97cdfeff9f8e27e626a2e4d355245c2c3cfe84c20e5c9cacbf0f1c6f3b2a;
bytes32 constant public ROLE_BROKER = 0x479dea472807244d782ec42517805a36afc50f2945705525f00c838a8092fd22;
bytes32 constant public ROLE_CLIENT_MANAGER = 0xec437cb06af8a25221e09283f6f475c389908a1a9e0011d1269d08c98b61eace;
bytes32 constant public ROLE_ENTITY_ADMIN = 0xc81e218d529a4be7d28a02bf81bcefbc4f2be10e0ca9f5ef68b8d52aac7895d6;
bytes32 constant public ROLE_ENTITY_MANAGER = 0x3984462fd165fbf2e7984b68e0af04fb2acdb7dd8f22c5d11089e3053793482d;
bytes32 constant public ROLE_ENTITY_REP = 0xbb4987a2e7e3670e922095c7aa56f5d871431249221cb25aa396e7c0892f468c;
bytes32 constant public ROLE_NAYM = 0xd28e8ae3ae16560e3f13c72e513fb725fbbe853f4f7a2319ff5660029be694b3;
bytes32 constant public ROLE_POLICY_OWNER = 0x75f9d284d94dd2f5bf06b897c98baf6b8bd4dd273056da8f36acb68025988694;
bytes32 constant public ROLE_SOLE_PROP = 0x045b7fe422305784550d6bdae881f42b26a4f7a9a98c234536b4d3a307014304;
bytes32 constant public ROLE_SYSTEM_ADMIN = 0x49de8992e61fed1e4f94ee08935c0d9383229bc81cedcbb04bbefac3612804f8;
bytes32 constant public ROLE_SYSTEM_MANAGER = 0x00c6311fef79c2a44bb1f3441f2c6b9c610eede3ef18d0f4fdb45ab6ecb9a92e;
bytes32 constant public ROLEGROUP_ASSET_MANAGERS = 0x309309dde7ef0b48cef4f5283944cb9081577247dff9d48427acb011b4aff349;
bytes32 constant public ROLEGROUP_BROKERS = 0xcb0bada9848c4c263d7e20ec9db68ac456456dd8c9f1b8037d0a0ffdd168bab4;
bytes32 constant public ROLEGROUP_CLIENT_MANAGERS = 0x3a2e45631f90f259eb1df721df379d439a5fa06fbc4bf57a3d05586aa228d6a3;
bytes32 constant public ROLEGROUP_ENTITY_ADMINS = 0xb69602dc57282aa569f0dd6f51b7a67691bdd26adb42da8a3124abde79a45786;
bytes32 constant public ROLEGROUP_ENTITY_MANAGERS = 0xd7db697581f34193921dfdc26c5564fc645207a39afc0ab56d11ff9f85905086;
bytes32 constant public ROLEGROUP_ENTITY_REPS = 0x95b7a720835c8fc5fb99bbd3f796f7840fb524149fd98793e98d20fb15df1c22;
bytes32 constant public ROLEGROUP_FUND_MANAGERS = 0xf17f5872bf269aa3ddb2020fa59f22b819dc652a65c0c786b55f06084d8b76e7;
bytes32 constant public ROLEGROUP_POLICY_APPROVERS = 0x1012134ecbfcf79fdb0a70d206face04b40d81e67e29abb4a65490b427be07cb;
bytes32 constant public ROLEGROUP_POLICY_CREATORS = 0x0f3c22643c2a35bcf194a5f6da4aba4ef8f02d545cc68c303fcf357af6d23151;
bytes32 constant public ROLEGROUP_POLICY_OWNERS = 0xcb6031cc247fb37c3ecb27f11b18b2beff17a816a688ce85547d00dbecccfd32;
bytes32 constant public ROLEGROUP_SYSTEM_ADMINS = 0x527f2b85e218b68c525b4df059712ff2795297ca966156613e5be4724ac951d3;
bytes32 constant public ROLEGROUP_SYSTEM_MANAGERS = 0x5d3c730c5ff3a14d0229a3776467fe3362af78a62ff229f6b4b077b5fb4bfd22;
bytes32 constant public ROLEGROUP_TRADERS = 0x456cf331bfae9e0745bc50b081be5cb4d3785dc720c568860227ec5c6d25389d;
// END: Generated by script outputRoleConstants.js
constructor (address _acl) public {
dataAddress["acl"] = _acl;
dataBytes32["aclContext"] = acl().generateContextFromAddress(address(this));
}
modifier assertIsAdmin () {
require(isAdmin(msg.sender), 'must be admin');
_;
}
function isAdmin (address _addr) public view returns (bool) {
return acl().isAdmin(_addr);
}
function inRoleGroup (address _addr, bytes32 _roleGroup) public view returns (bool) {
return inRoleGroupWithContext(aclContext(), _addr, _roleGroup);
}
function hasRole (address _addr, bytes32 _role) public view returns (bool) {
return hasRoleWithContext(aclContext(), _addr, _role);
}
function inRoleGroupWithContext (bytes32 _ctx, address _addr, bytes32 _roleGroup) public view returns (bool) {
return acl().hasRoleInGroup(_ctx, _addr, _roleGroup);
}
function hasRoleWithContext (bytes32 _ctx, address _addr, bytes32 _role) public view returns (bool) {
return acl().hasRole(_ctx, _addr, _role);
}
function acl () internal view returns (IACL) {
return IACL(dataAddress["acl"]);
}
function aclContext () public view returns (bytes32) {
return dataBytes32["aclContext"];
}
}
You can’t perform that action at this time.