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

Prevent teachers from unenrolling themselves unless they have the "unenrolself" capability

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 2.1.4, 3.1.2, 3.7, 3.8, 3.10.4, 4.2.2
    • Enrolments
    • Any
    • MOODLE_21_STABLE, MOODLE_310_STABLE, MOODLE_31_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_402_STABLE
    • MDL-31592_master-rc3
    • Hide

      Add "unenrolself" capability checks to unenroll and reset functionality?

      Show
      Add "unenrolself" capability checks to unenroll and reset functionality?
    • Hide
      1. Enrol a teacher into a course using manual enrolment
      2. Make sure the enrolled teacher does not have the capability “enrol/manual:unenrolself" by removing it from the edit roles page
      3. Login as the teacher who has been enrolled in step 1
      4. Enrol students in both manual and self enrolment
      5. Check the following scenarios:

      Scenario 1: (Screenshot 1)

      1. Go to the “Enrolled users” page of the course (enrol/users.php?id=...)
      2. You should not see the “X” or "trash" (unenrol) button next to the enrolment method name of the logged in teacher, as in the first attached screenshot

      Scenario 2: (Screenshot 2)

      1. If the logged in teacher tries to set their enrolment id manually (ue=…) on the page (/enrol/unenroluser.php), it should show an error message like in the second screenshot.

      Scenario 3: (Screenshot 3)

      1. Filter the users on the page “Enrolled users” (enrol/users.php?id=...) by Enrolment Method (for example manual).
      2. Select multiple users using checkboxes next to each user, including the logged in teacher
      3. From the bulk action menu, select “Delete selected user enrolments”
      4. Click the “Go” button
      5. It should unenrol all users except the logged in teacher

      Self enrolment test:

      1. Unenrol the teacher and turn on self enrolments for the course
      2. Log in as the teacher and self enrol them
      3. Make sure the enrolled teacher does not have the capability “enrol/self:unenrolself"
      4. Repeat scenario 1 2 & 3 with self enrolment

      Other enrolment test:

      1. Unenrol the teacher
      2. Set up enrolments of a third type (your preferred one - not manual or self)
      3. Log in as the teacher and enrol them using your preferred one
      4. Make sure the enrolled teacher does not have the capability “enrol/xxx:unenrolself" for that enrolment method
      5. Repeat scenario 1 2 & 3 with that enrolment method
      Show
      Enrol a teacher into a course using manual enrolment Make sure the enrolled teacher does not have the capability “enrol/manual:unenrolself" by removing it from the edit roles page Login as the teacher who has been enrolled in step 1 Enrol students in both manual and self enrolment Check the following scenarios: Scenario 1: (Screenshot 1) Go to the “Enrolled users” page of the course (enrol/users.php?id=...) You should not see the “X” or "trash" (unenrol) button next to the enrolment method name of the logged in teacher, as in the first attached screenshot Scenario 2: (Screenshot 2) If the logged in teacher tries to set their enrolment id manually (ue=…) on the page (/enrol/unenroluser.php), it should show an error message like in the second screenshot. Scenario 3: (Screenshot 3) Filter the users on the page “Enrolled users” (enrol/users.php?id=...) by Enrolment Method (for example manual). Select multiple users using checkboxes next to each user, including the logged in teacher From the bulk action menu, select “Delete selected user enrolments” Click the “Go” button It should unenrol all users except the logged in teacher Self enrolment test: Unenrol the teacher and turn on self enrolments for the course Log in as the teacher and self enrol them Make sure the enrolled teacher does not have the capability “enrol/self:unenrolself" Repeat scenario 1 2 & 3 with self enrolment Other enrolment test: Unenrol the teacher Set up enrolments of a third type (your preferred one - not manual or self) Log in as the teacher and enrol them using your preferred one Make sure the enrolled teacher does not have the capability “enrol/xxx:unenrolself" for that enrolment method Repeat scenario 1 2 & 3 with that enrolment method

      Users with capability "enrol/manual:unenrolself" set to "prohibit" can still unenroll themselves from the course through:

      1. Enrolled users management (enrol/users.php -> enrol/manual/unenroluser.php)
      2. Course reset (course/reset.php)

        1. me.png
          me.png
          21 kB
        2. other.png
          other.png
          21 kB
        3. Screenshot 1.png
          Screenshot 1.png
          242 kB
        4. Screenshot 2.png
          Screenshot 2.png
          114 kB
        5. Screenshot 3.png
          Screenshot 3.png
          228 kB
        6. unenrol_user.png
          unenrol_user.png
          19 kB

            Votes:
            31 Vote for this issue
            Watchers:
            25 Start watching this issue

              Created:
              Updated:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.