-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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
Revamped Access Control #2112
Revamped Access Control #2112
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lovely test suite! Great work.
20e2d2b
to
ac965e7
Compare
I commented out the tests for I manually changed the version on the package.json to make the semver check pass and verified that the tests indeed pass. |
1f3fcda
to
71f8da2
Compare
Going through previous comments I found that the issue with using I've been trying to think of alternatives anyway and actually revoked might be the best one. |
I understood your previous comment as meaning that the third event argument would make |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ship it.
This PR removes
Roles
and introducesAccessControl
, its replacement. We will need to update theaccess
mini readme andaccess control
guides in a later PR.Fixes #1772. Fixes #1602. Part of #2086. See this discussion on the forum for more context.
We're removing
Roles
to do away with the boilerplate associated with creating new roles, as well as the overhead introduced by the manyexternal
functions added by each. To achieve this purpose, roles are now referred to by a unique ID, and all functions are parametrized by this identifier.We're also changing some of the rules regarding how roles are granted and revoked:
internal
functionAccessControl
only add anexternal pure
getter for each newly defined roleNote that this does not separate
grant
andrevoke
concerns: a role’s admin can perform both tasks. I haven’t found scenarios in which this distinction is important.Finally, it should be noted that
AccessControl
can also be easily used as a standalone contract queried by multiple other contracts in a system by inheriting from it, setting up initial roles in a constructor and exposing_setRoleAdmin
externally.