Skip to content

Commit

Permalink
merged fix for MDL-9057, invalid contexts should be ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
toyomoyo committed Mar 27, 2007
1 parent 43e891e commit 863fb22
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/accesslib.php
Expand Up @@ -3847,6 +3847,14 @@ function user_has_role_assignment($userid, $roleid, $contextid=0) {
* @param bool deletechild - deltes child contexts dependencies
*/
function insert_context_rel($context, $deletechild=true, $deleteparent=true) {

// first check validity
// MDL-9057
if (!validate_context($context->contextlevel, $context->instanceid)) {
debugging('Error: Invalid context creation request for level "'.s($contextlevel).'", instance "'.s($instanceid).'".');
return NULL;
}

// removes all parents
if ($deletechild) {
delete_records('context_rel', 'c2', $context->id);
Expand Down

0 comments on commit 863fb22

Please sign in to comment.