mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 14:03:52 +01:00
MDL-11241, adding logs for roles management
This commit is contained in:
parent
8754093016
commit
cb8cb8bf88
@ -224,7 +224,9 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$rolename = get_field('role', 'name', 'id', $roleid);
|
||||
add_to_log($course->id, 'role', 'assign', 'admin/roles/assign.php?contextid='.$context->id.'&roleid='.$roleid, $rolename, '', $USER->id);
|
||||
} else if ($remove and !empty($frm->removeselect) and confirm_sesskey()) {
|
||||
|
||||
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
|
||||
@ -258,11 +260,16 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$rolename = get_field('role', 'name', 'id', $roleid);
|
||||
add_to_log($course->id, 'role', 'unassign', 'admin/roles/assign.php?contextid='.$context->id.'&roleid='.$roleid, $rolename, '', $USER->id);
|
||||
} else if ($showall) {
|
||||
$searchtext = '';
|
||||
$previoussearch = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if ($context->contextlevel==CONTEXT_COURSE and $context->instanceid == SITEID) {
|
||||
|
@ -121,9 +121,12 @@
|
||||
mark_context_dirty($sitecontext->path);
|
||||
|
||||
if (empty($errors)) {
|
||||
$rolename = get_field('role', 'name', 'id', $newroleid);
|
||||
add_to_log(SITEID, 'role', 'add', 'admin/roles/manage.php?action=add', $rolename, '', $USER->id);
|
||||
redirect('manage.php');
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
@ -233,6 +236,7 @@
|
||||
|
||||
// edited a role sitewide...
|
||||
mark_context_dirty($sitecontext->path);
|
||||
add_to_log(SITEID, 'role', 'edit', 'admin/roles/manage.php?action=edit&roleid='.$role->id, $role->name, '', $USER->id);
|
||||
|
||||
redirect('manage.php');
|
||||
}
|
||||
@ -240,6 +244,7 @@
|
||||
// edited a role sitewide - with errors, but still...
|
||||
mark_context_dirty($sitecontext->path);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
@ -360,6 +365,8 @@
|
||||
mark_context_dirty($sitecontext->path);
|
||||
|
||||
}
|
||||
$rolename = get_field('role', 'name', 'id', $newrole);
|
||||
add_to_log(SITEID, 'role', 'duplicate', 'admin/roles/manage.php?roleid='.$newrole.'&action=duplicate', $rolename, '', $USER->id);
|
||||
redirect('manage.php');
|
||||
break;
|
||||
|
||||
@ -374,6 +381,9 @@
|
||||
// reset a role sitewide...
|
||||
mark_context_dirty($sitecontext->path);
|
||||
|
||||
$rolename = get_field('role', 'name', 'id', $roleid);
|
||||
add_to_log(SITEID, 'role', 'reset', 'admin/roles/manage.php?roleid='.$roleid.'&action=reset', $rolename, '', $USER->id);
|
||||
|
||||
redirect('manage.php?action=view&roleid='.$roleid);
|
||||
|
||||
} else {
|
||||
|
@ -115,7 +115,8 @@
|
||||
|
||||
// force accessinfo refresh for users visiting this context...
|
||||
mark_context_dirty($context->path);
|
||||
|
||||
$rolename = get_field('role', 'name', 'id', $roleid);
|
||||
add_to_log($course->id, 'role', 'override', 'admin/roles/override.php?contextid='.$context->id.'&roleid='.$roleid, $rolename, '', $USER->id);
|
||||
redirect($baseurl);
|
||||
}
|
||||
|
||||
|
@ -2666,10 +2666,17 @@ function delete_role($roleid) {
|
||||
}
|
||||
|
||||
// finally delete the role itself
|
||||
// get this before the name is gone for logging
|
||||
$rolename = get_field('role', 'name', 'id', $roleid);
|
||||
|
||||
if ($success and !delete_records('role', 'id', $roleid)) {
|
||||
debugging("Could not delete role record with ID $roleid!");
|
||||
$success = false;
|
||||
}
|
||||
|
||||
if ($success) {
|
||||
add_to_log(SITEID, 'role', 'delete', 'admin/roles/action=delete&roleid='.$roleid, $rolename, '', $USER->id);
|
||||
}
|
||||
|
||||
return $success;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user