Affects Version/s: 2.6.2, 2.7, 2.8
- Run the behat tests group/tests/behat/create_groups.feature and and update_groups.feature
Affected Branches:MOODLE_26_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE
Fixed Branches:MOODLE_26_STABLE, MOODLE_27_STABLE
Pull from Repository:
Pull Master Branch:
Pull Master Diff URL:
Moodle allows teachers to create separate groups for the same course, but does not check for duplicate group enrollment keys. So when a student creates an account and enters this duplicate enrollment key, they will only be placed into the first group created using that key for the course.
Steps to recreate issue:
1. Log in with a teacher account
2. Select the course
3. Make sure the course settings have master enrollment key enabled and set.
4. Create a new group (Group1) and set group enrollment key. Ex. "password"
5. Log out and then log back in as a different teacher, select the same course and then repeat steps 3 and 4. except name the new group (Group2), but still use the same group enrollment key "password".
6. Log out and log back in again, but this time as brand new student account.
7. Select the course where the groups were setup and enter the enrollment key "password"
8. The student will be enrolled in the course and grouped into Group1 only, not Group2.
9. Similarly any number of new groups can be made using the same group enrollment key but different group names and no student will ever be able to be automatically enrolled into any group other than the first one created.
Just like the username and email are checked against the database when creating a new account. Group enrollment keys should be checked against any other previously existing enrollment keys, so that duplicates may not be used.