https://wiki.mahara.org/index.php?title=Developer_Area/UserRoles&feed=atom&action=historyDeveloper Area/UserRoles - Revision history2024-03-29T15:29:23ZRevision history for this page on the wikiMediaWiki 1.35.10https://wiki.mahara.org/index.php?title=Developer_Area/UserRoles&diff=12124&oldid=prevRobertl at 01:44, 24 May 20212021-05-24T01:44:09Z<p></p>
<table class="diff diff-contentalign-left diff-editfont-monospace" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en-GB">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 01:44, 24 May 2021</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l19" >Line 19:</td>
<td colspan="2" class="diff-lineno">Line 19:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>- activate() turn the role on and deal with what that should do</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>- activate() turn the role on and deal with what that should do</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>- deactivate() to turn the role off and deal with what that should do</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>- deactivate() to turn the role off and deal with what that should do</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">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));</ins></div></td></tr>
</table>Robertlhttps://wiki.mahara.org/index.php?title=Developer_Area/UserRoles&diff=12123&oldid=prevRobertl: Created page with "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 s..."2021-05-24T01:40:35Z<p>Created page with "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 s..."</p>
<p><b>New page</b></p><div>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.<br />
<br />
There currently is no form to add this role to a user but can be done via the SAML plugin<br />
<br />
However if you wanted to assign this role to an admin it can be done via the User object, eg:<br />
<br />
$USER->set_roles(array(array('role' => 'autogroupadmin',<br />
'institution' => '_site',<br />
'active' => 1,<br />
'provisioner' => 'custom')));<br />
<br />
The account roles are listed on the Account -> Profile page as well as being a setting on the Admin -> People -> Edit person page.<br />
<br />
You have the ability to make custom user roles and define what they are allowed to do<br />
<br />
To make a custom user role you need to first extend the UserRole class (see UserRoleAutogroupadmin) for example.<br />
<br />
The main things you can do with a custom role is <br />
- activate() turn the role on and deal with what that should do<br />
- deactivate() to turn the role off and deal with what that should do</div>Robertl