There is already an open discussion about how roles should be implemented in future version of Moodle? Or there is some documentation about?
General developer forum
Roles
This discussion has been locked so you can no longer reply to it.