Merge branch 'MDL-66683-master' of git://github.com/cescobedo/moodle

This commit is contained in:
Sara Arjona 2019-11-07 17:41:22 +01:00
commit 3a9c515057
2 changed files with 3 additions and 22 deletions

View File

@ -166,11 +166,9 @@ if ($editform->is_cancelled()) {
if (!empty($CFG->creatornewroleid) and !is_viewing($context, NULL, 'moodle/role:assign') and !is_enrolled($context, NULL, 'moodle/role:assign')) {
// Deal with course creators - enrol them internally with default role.
if (user_can_assign($context, $CFG->creatornewroleid)) {
enrol_try_internal_enrol($course->id, $USER->id, $CFG->creatornewroleid);
} else {
enrol_try_internal_enrol($course->id, $USER->id);
}
// Note: This does not respect capabilities, the creator will be assigned the default role.
// This is an expected behaviour. See MDL-66683 for further details.
enrol_try_internal_enrol($course->id, $USER->id, $CFG->creatornewroleid);
}
// The URL to take them to if they chose save and display.

View File

@ -85,7 +85,6 @@ Feature: Managers can create courses
| moodle/course:create | Allow |
| moodle/course:manageactivities | Allow |
| moodle/course:viewparticipants | Allow |
| moodle/role:assign | Allow |
And I log out
And I log in as "kevin"
And I am on site homepage
@ -96,20 +95,4 @@ Feature: Managers can create courses
And I press "Save and display"
And I follow "Participants"
Then I should see "Kevin the"
And I should not see "Teacher"
And I log out
Given I log in as "admin"
And I define the allowed role assignments for the "Creator" role as:
| Teacher | Assignable |
And I log out
And I log in as "kevin"
And I am on site homepage
And I turn editing mode on
When I press "Add a new course"
And I set the following fields to these values:
| Course full name | My second course |
| Course short name | mysecondcourse |
And I press "Save and display"
And I follow "Participants"
Then I should see "Kevin the"
And I should see "Teacher"