Further fixes for MDL-6601 ... that should be complete now.

This commit is contained in:
moodler 2006-09-23 06:10:48 +00:00
parent ea9fda2f88
commit 9991d157ea
2 changed files with 58 additions and 39 deletions

View file

@ -1087,8 +1087,7 @@ function islegacy($capabilityname) {
**********************************/
/**
* This should be called prolly everytime a user, group, module, course,
* coursecat or site is set up maybe?
* Create a new context record for use by all roles-related stuff
* @param $level
* @param $instanceid
*/
@ -1101,6 +1100,20 @@ function create_context($contextlevel, $instanceid) {
}
}
/**
* Create a new context record for use by all roles-related stuff
* @param $level
* @param $instanceid
*/
function delete_context($contextlevel, $instanceid) {
if ($context = get_context_instance($contextlevel, $instanceid)) {
return delete_records('context', 'id', $context->id) &&
delete_records('role_assignments', 'contextid', $context->id) &&
delete_records('role_role_capabilities', 'contextid', $context->id);
}
return true;
}
/**
* Get the context instance as an object. This function will create the
@ -2752,4 +2765,4 @@ function get_users_from_role_on_context($role, $context) {
AND roleid = $role->id");
}
?>
?>