I have extended the 5.0 accessManager and want to set permissions on new functions to control with roles from the AccessManager itself.
I came up with the following modifer...
modifier selfGuarded() {
(bool canExecute, ) = canCall(_msgSender(), address(this), msg.sig);
if (!canExecute) {
revert AccessDeniedToSelfFunction(_msgSender(), msg.sig);
}
_;
}
But I see now that the 5.1 contracts have an update to accessManager to ' Allow the onlyAuthorized
modifier to restrict functions added to the manager.`'
Can onlyAuhorized
functions be assigned to roles like how restricted
functions can?