Commit 01ab5b32 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Don't let institutional admins suspend site admins/staff

parent 266c3323
......@@ -267,10 +267,15 @@ else {
}
function edituser_suspend_submit(Pieform $form, $values) {
global $SESSION;
suspend_user($values['id'], $values['reason']);
$SESSION->add_ok_msg(get_string('usersuspended', 'admin'));
redirect('/admin/users/edit.php?id=' . $values['id']);
global $SESSION, $USER, $user;
if (!$USER->get('admin') && ($user->get('admin') || $user->get('staff'))) {
$SESSION->add_error_msg(get_string('errorwhilesuspending', 'admin'));
}
else {
suspend_user($user->get('id'), $values['reason']);
$SESSION->add_ok_msg(get_string('usersuspended', 'admin'));
}
redirect('/admin/users/edit.php?id=' . $user->get('id'));
}
function edituser_unsuspend_submit(Pieform $form, $values) {
......
......@@ -25,6 +25,7 @@
<p>{str tag="usereditdescription" section="admin"}</p>
{$siteform}
<!--<h3>{str tag="suspenduser" section="admin"}</h3>-->
{if $USER->get('admin') || (!$user->get('admin') && !$user->get('staff')) }
<hr>
<h3 id="suspend">{str tag="suspenddeleteuser" section=admin}</h3>
<p>{str tag="suspenddeleteuserdescription" section=admin}</p>
......@@ -43,6 +44,7 @@
{/if}
</tr>
</table>
{/if}
{if ($institutions)}
<hr>
......
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