HQ20 / contracts

A set of reusable smart-contracts

Home Page:https://hq20-contracts.netlify.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Introduce array of roleIds

alexroan opened this issue · comments

modifier onlyMember(bytes32 roleId) {

using an array instead of a single role would allow multiple roles to be granted access to a function.

Hi Alex. Yes, an array would allow several roles to be granted access to a function, but for this case I just needed to check membership to one role from addRole just below. I might implement your proposal in a separate contract. Let me think about it.

Hey Alberto, I proposed how this might be done here. Let me know your thoughts

That's a very well-written article, and interesting solution, congratulations.

There are two solutions to creating dynamic permissions. You can either leave the roles static and assign users to groups, which is what would happen with modifiers like onlyMinter. You can also leave the user groups static, and make dynamic modifiers like in your example, where instead of changing user membership to a role, you change roles required for a function.

So far, I've been able to use RBAC.sol (the precursor to AccessControl.sol) for everything I've come across in real life. AccessControl.sol just made it more efficient.

I wonder if the extra complexity is needed or not. If you come across a real world example where your solution was the best option it would make for a very interesting article.

I like your articles a lot, keep it up 👍