Add a boolean to AccessManager.GrantGroup (#4569)
This commit is contained in:
@ -372,7 +372,7 @@ contract AccessManager is Context, Multicall, IAccessManager {
|
|||||||
_groups[groupId].members[account] = Access({since: since, delay: executionDelay.toDelay()});
|
_groups[groupId].members[account] = Access({since: since, delay: executionDelay.toDelay()});
|
||||||
}
|
}
|
||||||
|
|
||||||
emit GroupGranted(groupId, account, executionDelay, since);
|
emit GroupGranted(groupId, account, executionDelay, since, !inGroup);
|
||||||
return !inGroup;
|
return !inGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ interface IAccessManager {
|
|||||||
event OperationCanceled(bytes32 indexed operationId, uint32 indexed nonce);
|
event OperationCanceled(bytes32 indexed operationId, uint32 indexed nonce);
|
||||||
|
|
||||||
event GroupLabel(uint64 indexed groupId, string label);
|
event GroupLabel(uint64 indexed groupId, string label);
|
||||||
event GroupGranted(uint64 indexed groupId, address indexed account, uint32 delay, uint48 since);
|
event GroupGranted(uint64 indexed groupId, address indexed account, uint32 delay, uint48 since, bool newMember);
|
||||||
event GroupRevoked(uint64 indexed groupId, address indexed account);
|
event GroupRevoked(uint64 indexed groupId, address indexed account);
|
||||||
event GroupAdminChanged(uint64 indexed groupId, uint64 indexed admin);
|
event GroupAdminChanged(uint64 indexed groupId, uint64 indexed admin);
|
||||||
event GroupGuardianChanged(uint64 indexed groupId, uint64 indexed guardian);
|
event GroupGuardianChanged(uint64 indexed groupId, uint64 indexed guardian);
|
||||||
|
|||||||
@ -106,7 +106,13 @@ contract('AccessManager', function (accounts) {
|
|||||||
|
|
||||||
const { receipt } = await this.manager.grantGroup(GROUPS.SOME, user, 0, { from: manager });
|
const { receipt } = await this.manager.grantGroup(GROUPS.SOME, user, 0, { from: manager });
|
||||||
const timestamp = await clockFromReceipt.timestamp(receipt).then(web3.utils.toBN);
|
const timestamp = await clockFromReceipt.timestamp(receipt).then(web3.utils.toBN);
|
||||||
expectEvent(receipt, 'GroupGranted', { groupId: GROUPS.SOME, account: user, since: timestamp, delay: '0' });
|
expectEvent(receipt, 'GroupGranted', {
|
||||||
|
groupId: GROUPS.SOME,
|
||||||
|
account: user,
|
||||||
|
since: timestamp,
|
||||||
|
delay: '0',
|
||||||
|
newMember: true,
|
||||||
|
});
|
||||||
|
|
||||||
expect(await this.manager.hasGroup(GROUPS.SOME, user).then(formatAccess)).to.be.deep.equal([true, '0']);
|
expect(await this.manager.hasGroup(GROUPS.SOME, user).then(formatAccess)).to.be.deep.equal([true, '0']);
|
||||||
|
|
||||||
@ -127,6 +133,7 @@ contract('AccessManager', function (accounts) {
|
|||||||
account: user,
|
account: user,
|
||||||
since: timestamp,
|
since: timestamp,
|
||||||
delay: executeDelay,
|
delay: executeDelay,
|
||||||
|
newMember: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(await this.manager.hasGroup(GROUPS.SOME, user).then(formatAccess)).to.be.deep.equal([
|
expect(await this.manager.hasGroup(GROUPS.SOME, user).then(formatAccess)).to.be.deep.equal([
|
||||||
@ -169,7 +176,7 @@ contract('AccessManager', function (accounts) {
|
|||||||
await time.increase(MINSETBACK);
|
await time.increase(MINSETBACK);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('granted group is not active immediatly', async function () {
|
it('granted group is not active immediately', async function () {
|
||||||
const { receipt } = await this.manager.grantGroup(GROUPS.SOME, user, 0, { from: manager });
|
const { receipt } = await this.manager.grantGroup(GROUPS.SOME, user, 0, { from: manager });
|
||||||
const timestamp = await clockFromReceipt.timestamp(receipt).then(web3.utils.toBN);
|
const timestamp = await clockFromReceipt.timestamp(receipt).then(web3.utils.toBN);
|
||||||
expectEvent(receipt, 'GroupGranted', {
|
expectEvent(receipt, 'GroupGranted', {
|
||||||
@ -177,6 +184,7 @@ contract('AccessManager', function (accounts) {
|
|||||||
account: user,
|
account: user,
|
||||||
since: timestamp.add(grantDelay),
|
since: timestamp.add(grantDelay),
|
||||||
delay: '0',
|
delay: '0',
|
||||||
|
newMember: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(await this.manager.hasGroup(GROUPS.SOME, user).then(formatAccess)).to.be.deep.equal([false, '0']);
|
expect(await this.manager.hasGroup(GROUPS.SOME, user).then(formatAccess)).to.be.deep.equal([false, '0']);
|
||||||
@ -196,6 +204,7 @@ contract('AccessManager', function (accounts) {
|
|||||||
account: user,
|
account: user,
|
||||||
since: timestamp.add(grantDelay),
|
since: timestamp.add(grantDelay),
|
||||||
delay: '0',
|
delay: '0',
|
||||||
|
newMember: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
await time.increase(grantDelay);
|
await time.increase(grantDelay);
|
||||||
@ -374,6 +383,7 @@ contract('AccessManager', function (accounts) {
|
|||||||
account: member,
|
account: member,
|
||||||
since: timestamp,
|
since: timestamp,
|
||||||
delay: newDelay,
|
delay: newDelay,
|
||||||
|
newMember: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
// immediate effect
|
// immediate effect
|
||||||
@ -406,6 +416,7 @@ contract('AccessManager', function (accounts) {
|
|||||||
account: member,
|
account: member,
|
||||||
since: timestamp.add(setback),
|
since: timestamp.add(setback),
|
||||||
delay: newDelay,
|
delay: newDelay,
|
||||||
|
newMember: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
// no immediate effect
|
// no immediate effect
|
||||||
@ -435,6 +446,7 @@ contract('AccessManager', function (accounts) {
|
|||||||
account: other,
|
account: other,
|
||||||
since: timestamp,
|
since: timestamp,
|
||||||
delay: executeDelay,
|
delay: executeDelay,
|
||||||
|
newMember: false,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user