built-in roles should be
6 guests
5 alumni
4 members
3 admins
2 owners
1 relayers
0 no-role
built-in relations beetwen roles should be
owners->owners
owners->admins
owners->members
owners->alumni
owners->guests
admins->members
admins->alumni
admins->guests
by the way owners can do anything so no need to store in storage this info. just hardcode in any validation
addmembers, removemembers, getMembers functions need to be removed. now we will remove logic that user should be in role members before role granted. now role will be granted to anyone if requireRole == 0 in function manageRole. see below
modify method
manageRole(byRole, ofRole, canGrantRole, canRevokeRole, requireRole=0, maxAddresses=0, duration=0)
requireRole - index or role.
means if user1 with byRole grant ofRole to user2, user2 should be in requireRole to be transaction successfully
membersCount should rename to addressesCount
create var addressesCounter - it's internal count of overall addresses in the contract. means addresses that have at least one role
need to make some changes
built-in roles should be 6 guests 5 alumni 4 members 3 admins 2 owners 1 relayers 0 no-role
built-in relations beetwen roles should be owners->owners owners->admins owners->members owners->alumni owners->guests admins->members admins->alumni admins->guests by the way owners can do anything so no need to store in storage this info. just hardcode in any validation
addmembers
,removemembers
,getMembers
functions need to be removed. now we will remove logic that user should be in rolemembers
before role granted. now role will be granted to anyone if requireRole == 0 in functionmanageRole
. see belowmodify method
manageRole(byRole, ofRole, canGrantRole, canRevokeRole, requireRole=0, maxAddresses=0, duration=0)
requireRole - index or role. means if user1 withbyRole
grantofRole
to user2, user2 should be inrequireRole
to be transaction successfullymembersCount should rename to
addressesCount
create var
addressesCounter
- it's internal count of overall addresses in the contract. means addresses that have at least one role