Developer Area/UserRoles

From Mahara Wiki

< Developer Area

Currently there is the UserRoleAutogroupadmin class build into mahara - this class allows you to add / remove a user as group admin of all existing groups in case you want a site admin be able to have an audit them as normally a site admin doesn't have access to all groups.

There currently is no form to add this role to a user but can be done via the SAML plugin

However if you wanted to assign this role to an admin it can be done via the User object, eg:

$USER->set_roles(array(array('role' => 'autogroupadmin',

                            'institution' => '_site',
                            'active' => 1,
                            'provisioner' => 'custom')));

The account roles are listed on the Account -> Profile page as well as being a setting on the Admin -> People -> Edit person page.

You have the ability to make custom user roles and define what they are allowed to do

To make a custom user role you need to first extend the UserRole class (see UserRoleAutogroupadmin) for example.

The main things you can do with a custom role is - activate() turn the role on and deal with what that should do - deactivate() to turn the role off and deal with what that should do

To allow some part of the core code to interact with the role you can add $USER->apply_userrole_method('method_name', array(parameter values));