Skip to content

Commit f17329f

Browse files
Krishang NadgaudaKrishang Nadgauda
authored andcommitted
add _checkRoleWithSwitch to Permissions
1 parent 061f972 commit f17329f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

contracts/feature/Permissions.sol

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,19 @@ contract Permissions is IPermissions {
7676
);
7777
}
7878
}
79+
80+
function _checkRoleWithSwitch(bytes32 role, address account) internal view virtual {
81+
if (!hasRoleWithSwitch(role, account)) {
82+
revert(
83+
string(
84+
abi.encodePacked(
85+
"AccessControl: account ",
86+
Strings.toHexString(uint160(account), 20),
87+
" is missing role ",
88+
Strings.toHexString(uint256(role), 32)
89+
)
90+
)
91+
);
92+
}
93+
}
7994
}

0 commit comments

Comments
 (0)