Permalink
Browse files

fix access check function for documents bug $context->instance to $co…

…ntext->instanceid
  • Loading branch information...
1 parent d622930 commit 39cfb0b068cb1a0fbe22eb724ce13c5a8e8c6693 diml committed Oct 7, 2007
@@ -330,7 +330,7 @@ function data_check_text_access($path, $itemtype, $this_id, $user, $group_id, $c
$data = get_record('data', 'id', $record->dataid);
$course = get_record('course', 'id', $data->course);
$module_context = get_record('context', 'id', $context_id);
- $cm = get_record('course_modules', 'id', $module_context->instance);
+ $cm = get_record('course_modules', 'id', $module_context->instanceid);
if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', $module_context)) return false;
//group consistency check : checks the following situations about groups
@@ -223,7 +223,7 @@ function glossary_check_text_access($path, $itemtype, $this_id, $user, $group_id
$glossary = get_record('glossary', 'id', $entry->glossaryid);
$course = get_record('course', 'id', $glossary->course);
$module_context = get_record('context', 'id', $context_id);
- $cm = get_record('course_modules', 'id', $module_context->instance);
+ $cm = get_record('course_modules', 'id', $module_context->instanceid);
if (!$cm->visible && !has_capability('moodle/course:viewhiddenactivities', $module_context)) return false;
//approval check : entries should be approved for being viewed, or belongs to the user unless the viewer can approve them or manage them
@@ -295,7 +295,7 @@ function resource_check_text_access($path, $itemtype, $this_id, $user, $group_id
$r = get_record('resource', 'id', $this_id);
$module_context = get_record('context', 'id', $context_id);
- $cm = get_record('course_modules', 'id', $module_context->instance);
+ $cm = get_record('course_modules', 'id', $module_context->instanceid);
//check if found course module is visible
if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', $module_context)){
@@ -252,7 +252,7 @@ function techproject_check_text_access($path, $entry_type, $this_id, $user, $gro
$techproject = get_record('techproject', 'id', $this_id);
$course = get_record('course', 'id', $techproject->course);
$module_context = get_record('context', 'id', $context_id);
- $cm = get_record('course_modules', 'id', $module_context->instance);
+ $cm = get_record('course_modules', 'id', $module_context->instanceid);
if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', $module_context)) return false;
//group consistency check : checks the following situations about groups
@@ -233,7 +233,7 @@ function wiki_check_text_access($path, $itemtype, $this_id, $user, $group_id, $c
$entry = get_record('wiki_entries', 'id', $page->wiki);
$course = get_record('course', 'id', $entry->course);
$module_context = get_record('context', 'id', $context_id);
- $cm = get_record('course_modules', 'id', $module_context->instance);
+ $cm = get_record('course_modules', 'id', $module_context->instanceid);
if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', $module_context)) return false;
//group consistency check : checks the following situations about groups

0 comments on commit 39cfb0b

Please sign in to comment.