ds-roles icon indicating copy to clipboard operation
ds-roles copied to clipboard

allow naming roles

Open nmushegian opened this issue 8 years ago • 1 comments

You should be able to name a role (.e.g 0 -> "admin"), then set by name instead of ID

nmushegian avatar Aug 30 '16 14:08 nmushegian

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)

rainbreak avatar Oct 14 '16 04:10 rainbreak