mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
fix access check function for documents bug $context->instance to $context->instanceid
This commit is contained in:
parent
d622930b39
commit
39cfb0b068
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user