Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-46803

Course reset unenrols users from all their roles

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      test environment

      1. enrol a user in a course with two different roles (e.g: student and teacher)

      test scenario

      1. Reset the course (Course administration > Reset) - Roles. Select only the student role. Click the "Reset course" button.
      2. Go to the participants page (Navigation block / navigation drawer)
      3. Check that our user is still enroled in course with the teacher role.
      4. Give the user the student role again. Click the icon next to the Role for the user.
      5. Reset the course (Course administration > Reset) - Roles. Select only the teacher role. Click the "Reset course" button.
      6. Go to the participants page (Navigation block / navigation drawer)
      7. Check that our user is still enroled in course with the student role
      8. Give the user the teacher role again. Click the icon next to the Role for the user.
      9. Reset the course (Course administration > Reset) - Roles. Select only the manager role. Click the "Reset course" button.
      10. Go to the participants page (Navigation block / navigation drawer)
      11. Check that our user is still enroled in course with the student role and teacher role
      12. Reset the course (Course administration > Reset) - Roles. Select the teacher and student role. Click the "Reset course" button.
      13. Go to the participants page (Navigation block / navigation drawer)
      14. Check that the user has now be unenroled from the course.

       

      Show
      test environment enrol a user in a course with two different roles (e.g: student and teacher) test scenario Reset the course (Course administration > Reset) - Roles. Select only the student role. Click the "Reset course" button. Go to the participants page (Navigation block / navigation drawer) Check that our user is still enroled in course with the teacher role. Give the user the student role again. Click the icon next to the Role for the user. Reset the course (Course administration > Reset) - Roles. Select only the teacher role. Click the "Reset course" button. Go to the participants page (Navigation block / navigation drawer) Check that our user is still enroled in course with the student role Give the user the teacher role again. Click the icon next to the Role for the user. Reset the course (Course administration > Reset) - Roles. Select only the manager role. Click the "Reset course" button. Go to the participants page (Navigation block / navigation drawer) Check that our user is still enroled in course with the student role and teacher role Reset the course (Course administration > Reset) - Roles. Select the teacher and student role. Click the "Reset course" button. Go to the participants page (Navigation block / navigation drawer) Check that the user has now be unenroled from the course.  
    • Affected Branches:
      MOODLE_26_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE
    • Fixed Branches:
      MOODLE_35_STABLE, MOODLE_36_STABLE
    • Pull 3.5 Branch:
      MDL-46803-greedy-roles-reset-MOODLE_35
    • Pull 3.6 Branch:
      MDL-46803-greedy-roles-reset-MOODLE_36
    • Pull Master Branch:
      MDL-46803-greedy-roles-reset2

      Description

      Steps to reproduce:

      • In a course, go to Users > Enrolled users
      • Enrol user1 with Teacher role
      • Enrol user2 with Teacher and Student role
      • In course administration, go to Reset
      • In Reset course screen under Roles, select Unenrol users: Student
      • click on "Reset course"
      • back in Users > Enrolled users, notice how user2 has vanished.

      Course reset obviously unenrols users matching the role chosen in the Reset course screen from all roles in the course.
      This is problematic with users having more than one role.
      We have seen cases of teachers locking themselves out of their own course after doing a course reset. It turned out they were enrolled with both Teacher and Student role.
      It would perhaps be more intuitive to remove only the selected role but leave the enrolment and other roles intact if there are any.

      In the database, unenrol users removes all role assignments for matching users from table mdl_role_assignments and deletes the row from table mdl_user_enrolments.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                2 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  13/May/19

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 hours
                  2h