Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce array of roleIds #303

Open
alexroan opened this issue Apr 16, 2020 · 3 comments
Open

Introduce array of roleIds #303

alexroan opened this issue Apr 16, 2020 · 3 comments

Comments

@alexroan
Copy link

modifier onlyMember(bytes32 roleId) {

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

@alcueca
Copy link
Contributor

alcueca commented Apr 16, 2020

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.

@alexroan
Copy link
Author

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

@alcueca
Copy link
Contributor

alcueca commented Apr 19, 2020

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 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants