Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Ernesto García <ernestognw@gmail.com>
  • Loading branch information
frangio and ernestognw authored Mar 22, 2023
1 parent 597edc0 commit ee560d0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion contracts/access/manager/AccessManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ contract AccessManager is IAccessManager, AccessControlDefaultAdminRules {
* @dev Returns true if the caller can invoke on a target the function identified by a function selector.
* Entrypoint for {AccessManaged} contracts.
*/
function canCall(address caller, address target, bytes4 selector) public view returns (bool) {
function canCall(address caller, address target, bytes4 selector) public view virtual returns (bool) {
bytes32 allowedGroups = getFunctionAllowedGroups(target, selector);
bytes32 callerGroups = getUserGroups(caller);
return callerGroups & allowedGroups != 0;
Expand Down
4 changes: 2 additions & 2 deletions test/access/manager/AccessManaged.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ contract('AccessManaged', function (accounts) {
describe('restricted', function () {
const selector = web3.eth.abi.encodeFunctionSignature('restrictedFunction()');

it('allows if authority says true', async function () {
it('allows if authority returns true', async function () {
const authority = await SimpleAuthority.new();
const managed = await AccessManaged.new(authority.address);
await authority.setAllowed(user, managed.address, selector);
const restricted = await managed.restrictedFunction({ from: user });
expectEvent(restricted, 'RestrictedRan');
});

it('reverts if authority says false', async function () {
it('reverts if authority returns false', async function () {
const authority = await SimpleAuthority.new();
const managed = await AccessManaged.new(authority.address);
await expectRevert(managed.restrictedFunction({ from: user }), 'AccessManaged: authority rejected');
Expand Down

0 comments on commit ee560d0

Please # to comment.