Commit 2ea8383f authored by Nitish Bezzala's avatar Nitish Bezzala
Browse files

Institution admin can remove a user from another institution (Bug


For an institute admin, we get the list of all institutions
which he belongs to and filter out those for which he is not an admin.
Then we find the institutions which are common to the admin and the
user whose profile is being edited.

Change-Id: I02fb5a8a34e9dc070f15dc5aceb0a2459593132b
Signed-off-by: default avatarNitish Bezzala <>
parent 8f46cdab
......@@ -641,8 +641,19 @@ $elements = array(
function is_institute_admin($institution) {
return $institution->admin;
$institutions = $user->get('institutions');
if ( !$USER->get('admin') ) { // for institution admins
$admin_institutions = $USER->get('institutions');
$admin_institutions = array_filter($admin_institutions, "is_institute_admin");
$institutions = array_intersect_key($institutions, $admin_institutions);
$allinstitutions = get_records_assoc('institution', '', '', 'displayname');
foreach ($user->get('institutions') as $i) {
foreach ($institutions as $i) {
$elements[$i->institution.'_settings'] = array(
'type' => 'fieldset',
'legend' => $allinstitutions[$i->institution]->displayname,
......@@ -841,7 +841,7 @@ $string['authenticatedbydescription'] = 'How this user authenticates to Mahara';
$string['remoteusername'] = 'Username for external authentication';
$string['remoteusernamedescription1'] = 'If this user signs in to %s from a remote site using an external authentication plugin, this is the username which identifies the user on the remote site.';
$string['institutionsettings'] = 'Institution settings';
$string['institutionsettingsdescription'] = 'Here you can change settings regarding this user\'s membership with institutions in the system.';
$string['institutionsettingsdescription'] = 'Here you can change settings regarding this user\'s membership for institutions you are an administrator of.';
$string['changeinstitution'] = 'Change institution';
$string['institutionstaff'] = 'Institution staff';
$string['institutionadmins'] = 'Institution administrators';
Supports Markdown
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