2019-03-14 23:41:04 -07:00
|
|
|
pragma solidity ^0.5.3;
|
|
|
|
|
|
|
|
import "./PermissionsImplementation.sol";
|
2019-03-15 02:26:57 -07:00
|
|
|
import "./PermissionsUpgradable.sol";
|
|
|
|
|
2019-03-14 23:41:04 -07:00
|
|
|
|
|
|
|
contract PermissionsInterface {
|
2019-03-15 02:26:57 -07:00
|
|
|
PermissionsImplementation private permImplementation;
|
2019-03-19 02:15:51 -07:00
|
|
|
PermissionsUpgradable private permUpgradable;
|
2019-03-14 23:41:04 -07:00
|
|
|
address private permImplUpgradeable;
|
|
|
|
|
|
|
|
constructor(address _permImplUpgradeable) public {
|
|
|
|
permImplUpgradeable = _permImplUpgradeable;
|
|
|
|
}
|
|
|
|
|
|
|
|
modifier onlyUpgradeable {
|
|
|
|
require(msg.sender == permImplUpgradeable);
|
|
|
|
_;
|
|
|
|
}
|
|
|
|
|
|
|
|
function setPermImplementation(address _permImplementation) public
|
|
|
|
onlyUpgradeable
|
|
|
|
{
|
|
|
|
permImplementation = PermissionsImplementation(_permImplementation);
|
|
|
|
}
|
|
|
|
|
2019-05-08 20:07:54 -07:00
|
|
|
function getPermissionsImpl() public view returns (address)
|
2019-03-14 23:41:04 -07:00
|
|
|
{
|
|
|
|
return address(permImplementation);
|
|
|
|
}
|
|
|
|
|
|
|
|
function setPolicy(string calldata _nwAdminOrg, string calldata _nwAdminRole, string calldata _oAdminRole) external
|
|
|
|
{
|
|
|
|
permImplementation.setPolicy(_nwAdminOrg, _nwAdminRole, _oAdminRole);
|
|
|
|
}
|
|
|
|
|
2019-06-02 22:37:23 -07:00
|
|
|
function init(uint _breadth, uint _depth) external
|
2019-03-14 23:41:04 -07:00
|
|
|
{
|
2019-06-02 22:37:23 -07:00
|
|
|
permImplementation.init(_breadth, _depth);
|
2019-03-14 23:41:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
function addAdminNodes(string calldata _enodeId) external
|
|
|
|
{
|
|
|
|
permImplementation.addAdminNodes(_enodeId);
|
|
|
|
}
|
|
|
|
|
|
|
|
function addAdminAccounts(address _acct) external
|
|
|
|
{
|
|
|
|
permImplementation.addAdminAccounts(_acct);
|
|
|
|
}
|
|
|
|
|
|
|
|
// update the network boot status as true
|
|
|
|
function updateNetworkBootStatus() external
|
|
|
|
returns (bool)
|
|
|
|
{
|
|
|
|
permImplementation.updateNetworkBootStatus();
|
|
|
|
}
|
|
|
|
|
|
|
|
// // Get network boot status
|
|
|
|
function getNetworkBootStatus() external view returns (bool)
|
|
|
|
{
|
|
|
|
return permImplementation.getNetworkBootStatus();
|
|
|
|
}
|
|
|
|
|
|
|
|
// function for adding a new master org
|
2019-04-08 01:57:36 -07:00
|
|
|
function addOrg(string calldata _orgId, string calldata _enodeId, address _account) external
|
2019-03-14 23:41:04 -07:00
|
|
|
{
|
2019-04-08 01:57:36 -07:00
|
|
|
permImplementation.addOrg(_orgId, _enodeId, _account, msg.sender);
|
2019-03-14 23:41:04 -07:00
|
|
|
}
|
|
|
|
|
2019-04-08 01:57:36 -07:00
|
|
|
function approveOrg(string calldata _orgId, string calldata _enodeId, address _account) external
|
2019-04-03 07:25:01 -07:00
|
|
|
{
|
2019-04-08 07:26:13 -07:00
|
|
|
permImplementation.approveOrg(_orgId, _enodeId, _account, msg.sender);
|
2019-04-03 07:25:01 -07:00
|
|
|
}
|
|
|
|
|
2019-04-08 07:26:13 -07:00
|
|
|
// function for adding a new master org
|
2019-05-12 23:15:09 -07:00
|
|
|
function addSubOrg(string calldata _pOrg, string calldata _orgId, string calldata _enodeId) external
|
2019-05-08 03:01:30 -07:00
|
|
|
{
|
2019-05-12 23:15:09 -07:00
|
|
|
permImplementation.addSubOrg(_pOrg, _orgId, _enodeId, msg.sender);
|
2019-04-08 07:26:13 -07:00
|
|
|
}
|
|
|
|
|
2019-05-12 23:15:09 -07:00
|
|
|
function updateOrgStatus(string calldata _orgId, uint _action) external
|
2019-03-28 02:53:11 -07:00
|
|
|
{
|
2019-05-12 23:15:09 -07:00
|
|
|
permImplementation.updateOrgStatus(_orgId, _action, msg.sender);
|
2019-03-28 02:53:11 -07:00
|
|
|
}
|
|
|
|
|
2019-05-12 23:15:09 -07:00
|
|
|
function approveOrgStatus(string calldata _orgId, uint _action) external
|
2019-03-28 02:53:11 -07:00
|
|
|
{
|
2019-05-12 23:15:09 -07:00
|
|
|
permImplementation.approveOrgStatus(_orgId, _action, msg.sender);
|
2019-03-28 02:53:11 -07:00
|
|
|
}
|
2019-03-14 23:41:04 -07:00
|
|
|
|
|
|
|
// Role related functions
|
2019-04-26 01:35:51 -07:00
|
|
|
function addNewRole(string calldata _roleId, string calldata _orgId, uint _access, bool _voter, bool _admin) external
|
2019-03-14 23:41:04 -07:00
|
|
|
{
|
2019-04-26 01:35:51 -07:00
|
|
|
permImplementation.addNewRole(_roleId, _orgId, _access, _voter, _admin, msg.sender);
|
2019-03-14 23:41:04 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
function removeRole(string calldata _roleId, string calldata _orgId) external
|
|
|
|
{
|
2019-03-29 01:47:14 -07:00
|
|
|
permImplementation.removeRole(_roleId, _orgId, msg.sender);
|
2019-04-04 03:25:43 -07:00
|
|
|
}
|
2019-03-14 23:41:04 -07:00
|
|
|
|
2019-04-23 23:40:28 -07:00
|
|
|
function assignAdminRole(string calldata _orgId, address _account, string calldata _roleId) external
|
2019-03-14 23:41:04 -07:00
|
|
|
{
|
2019-04-23 23:40:28 -07:00
|
|
|
permImplementation.assignAdminRole(_orgId, _account, _roleId, msg.sender);
|
2019-03-14 23:41:04 -07:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-04-23 23:40:28 -07:00
|
|
|
function approveAdminRole(string calldata _orgId, address _account) external
|
2019-03-14 23:41:04 -07:00
|
|
|
{
|
2019-04-23 23:40:28 -07:00
|
|
|
permImplementation.approveAdminRole(_orgId, _account, msg.sender);
|
2019-03-14 23:41:04 -07:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-04-04 03:25:43 -07:00
|
|
|
function assignAccountRole(address _acct, string memory _orgId, string memory _roleId) public
|
2019-03-14 23:41:04 -07:00
|
|
|
{
|
2019-03-27 04:07:01 -07:00
|
|
|
permImplementation.assignAccountRole(_acct, _orgId, _roleId, msg.sender);
|
2019-03-14 23:41:04 -07:00
|
|
|
|
|
|
|
}
|
2019-04-14 21:32:06 -07:00
|
|
|
|
|
|
|
function updateAccountStatus(string calldata _orgId, address _account, uint _status) external
|
|
|
|
{
|
|
|
|
permImplementation.updateAccountStatus(_orgId, _account, _status, msg.sender);
|
|
|
|
}
|
|
|
|
|
2019-03-14 23:41:04 -07:00
|
|
|
function addNode(string calldata _orgId, string calldata _enodeId) external
|
|
|
|
{
|
2019-03-27 04:07:01 -07:00
|
|
|
permImplementation.addNode(_orgId, _enodeId, msg.sender);
|
2019-03-14 23:41:04 -07:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-05-12 23:15:09 -07:00
|
|
|
function updateNodeStatus(string calldata _orgId, string calldata _enodeId, uint _action) external
|
2019-03-28 02:53:11 -07:00
|
|
|
{
|
2019-05-12 23:15:09 -07:00
|
|
|
permImplementation.updateNodeStatus(_orgId, _enodeId, _action, msg.sender);
|
2019-03-28 02:53:11 -07:00
|
|
|
}
|
|
|
|
|
2019-03-14 23:41:04 -07:00
|
|
|
function isNetworkAdmin(address _account) public view returns (bool)
|
|
|
|
{
|
|
|
|
return permImplementation.isNetworkAdmin(_account);
|
|
|
|
}
|
|
|
|
|
|
|
|
function isOrgAdmin(address _account, string memory _orgId) public view returns (bool)
|
|
|
|
{
|
2019-04-08 23:58:30 -07:00
|
|
|
|
2019-03-14 23:41:04 -07:00
|
|
|
return permImplementation.isOrgAdmin(_account, _orgId);
|
|
|
|
}
|
|
|
|
|
|
|
|
function validateAccount(address _account, string memory _orgId) public view returns (bool)
|
|
|
|
{
|
|
|
|
return permImplementation.validateAccount(_account, _orgId);
|
|
|
|
}
|
|
|
|
|
2019-04-08 23:58:30 -07:00
|
|
|
function getPendingOp(string calldata _orgId) external view returns (string memory, string memory, address, uint)
|
|
|
|
{
|
|
|
|
return permImplementation.getPendingOp(_orgId);
|
|
|
|
}
|
|
|
|
|
2019-03-14 23:41:04 -07:00
|
|
|
}
|