permissions: modified implementation contract for creating orgadmin role, added status to account access modified event

This commit is contained in:
vsmk98 2019-03-29 12:27:13 +08:00
parent ca499fb30b
commit 07f26bdb6c
2 changed files with 4 additions and 3 deletions

View File

@ -22,7 +22,7 @@ contract AccountManager {
mapping(bytes32 => bool) private orgAdminIndex; mapping(bytes32 => bool) private orgAdminIndex;
// account permission events // account permission events
event AccountAccessModified(address _address, string _orgId, string _roleId, bool _orgAdmin); event AccountAccessModified(address _address, string _orgId, string _roleId, bool _orgAdmin, uint _status);
event AccountAccessRevoked(address _address, string _orgId, string _roleId, bool _orgAdmin); event AccountAccessRevoked(address _address, string _orgId, string _roleId, bool _orgAdmin);
modifier onlyImpl modifier onlyImpl
@ -95,7 +95,7 @@ contract AccountManager {
if (_oAdmin) { if (_oAdmin) {
orgAdminIndex[keccak256(abi.encodePacked(_orgId))] = true; orgAdminIndex[keccak256(abi.encodePacked(_orgId))] = true;
} }
emit AccountAccessModified(_address, _orgId, _roleId, _oAdmin); emit AccountAccessModified(_address, _orgId, _roleId, _oAdmin, _status);
} }
function addNWAdminAccount(address _address, string calldata _orgId) external function addNWAdminAccount(address _address, string calldata _orgId) external
@ -132,7 +132,7 @@ contract AccountManager {
(status == 1)) { (status == 1)) {
uint aIndex = getAcctIndex(_address); uint aIndex = getAcctIndex(_address);
acctAccessList[aIndex].status = 2; acctAccessList[aIndex].status = 2;
emit AccountAccessModified(_address, acctAccessList[aIndex].orgId, acctAccessList[aIndex].role, acctAccessList[aIndex].orgAdmin); emit AccountAccessModified(_address, acctAccessList[aIndex].orgId, acctAccessList[aIndex].role, acctAccessList[aIndex].orgAdmin, acctAccessList[aIndex].status);
} }
} }

View File

@ -144,6 +144,7 @@ contract PermissionsImplementation {
require(checkOrgStatus(_orgId, 1) == true, "Nothing to approve"); require(checkOrgStatus(_orgId, 1) == true, "Nothing to approve");
if ((processVote(adminOrg, _caller, 1))) { if ((processVote(adminOrg, _caller, 1))) {
org.approveOrg(_orgId); org.approveOrg(_orgId);
roles.addRole(orgAdminRole, _orgId, fullAccess, true);
nodes.approveNode(_enodeId, _orgId); nodes.approveNode(_enodeId, _orgId);
} }
} }