Commit 6af81f07 authored by Richard Mansfield's avatar Richard Mansfield

Allow non-staff users to become admin of course group (bug #603044)

Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent 2dbd0e3d
......@@ -84,6 +84,13 @@ abstract class GroupType {
public static function can_be_created_by_user() {
return true;
}
/**
* Returns whether a user can be promoted to admin of a group of this
* grouptype (by an existing group admin, on the 'change role' page)
*/
public static function can_become_admin($userid) {
return true;
}
/**
* Returns the roles this group type implements
......
......@@ -109,10 +109,8 @@ function group_can_change_role($groupid, $userid, $role) {
// admin role permissions check
if ($role == 'admin') {
$group = group_current_group();
$user = new User();
$user->find_by_id($userid);
safe_require('grouptype', $group->grouptype);
return in_array($group->jointype, call_static_method('GroupType' . $group->grouptype, 'user_allowed_join_types', $user));
return call_static_method('GroupType' . $group->grouptype, 'can_become_admin', $userid);
}
return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment