MDL-21655 big scary enrolment and roles improvements - see tacker for list of changes, includes other minor fixes too

This commit is contained in:
Petr Skoda
2010-03-31 07:41:31 +00:00
parent d1d4813ff2
commit 4f0c2d0009
225 changed files with 2941 additions and 3097 deletions
+2 -2
View File
@@ -132,7 +132,7 @@ class blog_edit_form extends moodleform {
$coursecontext = $DB->get_record('context', array('id' => $data['courseassoc'], 'contextlevel' => CONTEXT_COURSE));
if ($coursecontext) {
if (!has_capability('moodle/course:view', $coursecontext, $USER->id)) {
if (!is_enrolled($coursecontext) and !is_viewing($coursecontext)) {
$errors['courseassoc'] = get_string('studentnotallowed', '', fullname($USER, true));
}
} else {
@@ -161,7 +161,7 @@ class blog_edit_form extends moodleform {
}
// ensure the user has access to each mod's course
if (!has_capability('moodle/course:view', $coursecontext)) {
if (!is_enrolled($modcontext) and !is_viewing($modcontext)) {
$errors['modassoc'] = get_string('studentnotallowed', '', fullname($USER, true));
}
} else {