ds-roles
ds-roles copied to clipboard
allow naming roles
You should be able to name a role (.e.g 0 -> "admin"), then set by name instead of ID
I'm thinking something like this:
mapping(string => uint8) _named_roles;
uint8 _nroles;
// new methods
function setUserRoleName(uint8 role, string name) // name an existing role
function addUserRole(string name) returns (uint8 role) // create a new role by name (increments nroles)
// overloaded existing methods
function hasUserRole(address who, string role) returns (bool)
function setUserRole(address who, string role, bool enabled)
function setRoleCapability(string role, address code, bytes4 sig, bool enabled)
Other ideas:
- force usage of role naming (remove methods using uint8 args)