Creating Roles
Roles are created in the configuration file. What roles you choose are completely up to you, BitAuth only requires one: admin. The roles section of the configuration file looks like this:
/**
* Your roles. These are how you call permissions checks in your code.
* eg: if($this->bitauth->has_role('example_role'))
*/
$config['roles'] = array(
/**
* THE FIRST ROLE IS ALWAYS THE ADMINISTRATOR ROLE
* ANY USERS IN GROUPS GIVEN THIS ROLE WILL HAVE FULL ACCESS
*/
'admin' => 'User is an Administrator',
/**
* Add as many roles here as you like.
* Follow the format:
* 'role_slug' => 'Role Description',
*/
);
Creating roles is as simple as adding new elements to this array:
'sample_role' => 'This is a sample role',
The slug is how you check that role in your code. The description is how you describe that role in human-readable language.
You can add any number of roles you like in this format, as long as the first (admin) remains at the top of the list. You can change the slug and description of this role, the first on the list will always be treated as the administrator role. No matter what you change the slug to be, you can always check for this role with $this->bitauth->is_admin().