BitAuth User Guide Version 1.0


Setting Roles

Setting roles on a group is simple. All you need to do is set the roles attribute when adding or updating a group:

When Adding a Group

$group = array(
    'name'        => 'Test Group',
    'description' => 'This is a test group.',
    'roles'       => array('new_role_1', 'new_role_2')
);

$this->bitauth->add_group($group);

The example included in the BitAuth download gives an example of how to do this easily with an HTML form.

When Updating a Group

$group = $this->bitauth->get_group_by_name('Test Group');

$group->roles = array('new_role_1', 'new_role_2');
$this->bitauth->update_group($group->group_id, $group);

Any changes you make to group roles are reflected in all members of that group the next time they log in.