MDL-11241, adding logs for roles management

This commit is contained in:
toyomoyo 2007-10-18 05:53:14 +00:00
parent 8754093016
commit cb8cb8bf88
4 changed files with 28 additions and 3 deletions

View File

@ -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) {

View File

@ -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 {

View File

@ -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);
}

View File

@ -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;
}