Fortunately WordPress gives you a way to manipulate the role mechanism in its core functionality.
The functions that we will be working with are:
- add_role(): Add a custom role
- remove_role(): Remove a custom role
- add_cap(): Add a custom capability to a role
- remove_cap(): Remove a custom capability from a role
- get_role (): Get information on a given role