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

Option to not include permissions overrides when importing or restoring a backup

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Preparation

      1. Create 3 courses - A, B, and C.
      2. In the "Course A", make a override permission to 'enrol/manual:enrol' for role 'Non-editing teacher' as following processes.
        1. Go to "Course A" homepage, click "More..." from cog icon.
        2. Click "Users", then click "Permissions" in the course administration page.
        3. Filter by 'enrol/manual:enrol', and add 'Non-editing teacher' to "Roles with permission".
      3. Create a backup ("Backup-A") from "Course A" as following processes.
        1. Go to "Course A" homepage, click "Backup" from cog icon.
        2. Click "Jump to final step".
        3. Click "Continue" to complete the backup.

      Test default settings

      1. In site administration page, search setting by "backup".
      2. Confirm "Include override permissions" options are in the category below, with NOTE:
        • General import defaults (backup | backup_import_permissions), Default: No
        • General restore defaults (restore | restore_general_permissions), Default: Yes
      3. Set "Include override permissions" for "General import defaults" OFF and "General restore defaults" ON from administration page.
      4. Confirm "Include override permissions" is OFF for "General import defaults" as following processes.
        1. Go to "Course B" homepage, and click "Import" from cog icon.
        2. Choose "Course A" in course selection, and click "Continue".
        3. Confirm "Include override permissions" is NOT selected.
      5. Confirm "Include override permissions" is ON for "General restore defaults" as following processes.
        1. Go to "Course A" homepage.
        2. Click "Restore" from cog icon.
        3. Click "Restore" from "Backup-A" in Unit backup area.
        4. Click "Continue" in "Confirm" section.
        5. Choose a category in "Restore as a new course", and click "Continue".
        6. Confirm "Include override permissions" is selected.
      6. Set "Include override permissions" for "General import defaults" ON and "General restore defaults" OFF from administration page.
      7. Confirm "Include override permissions" is ON for "General import defaults" as following processes. 
        1. Go to "Course B" homepage, and click "Import" from cog icon.
        2. Choose "Course A" in course selection, and click "Continue".
        3. Confirm "Include override permissions" is selected.
      8. Confirm "Include override permissions" is OFF for "General restore defaults" as following processes. 
        1. Go to "Course A" homepage.
        2. Click "Restore" from cog icon.
        3. Click "Restore" from "Backup-A" in Unit backup area.
        4. Click "Continue" in "Confirm" section.
        5. Choose a category in "Restore as a new course", and click "Continue".
        6. Confirm "Include override permissions" is NOT selected.

      Test Import

      1. Import from "Course A" to "Course B" as following processes.
        1. Go to "Course B" homepage, and click "Import" from cog icon.
        2. Choose "Course A" in course selection, and click "Continue".
        3. Make sure "Include override permissions" is ticked, and click "Jump to final step".
        4. Click "Continue".
      2. Confirm the "Course B" has 'enrol/manual:enrol' permission for role 'Non-editing teacher' as following processes.
        1. Click "More..." from cog icon.
        2. Click "Users", then click "Permissions" in the course administration page.
        3. Filter by 'enrol/manual:enrol'.
        4. Confirm 'Non-editing teacher' is in "Roles with permission".
      3. Import from "Course A" to "Course C" as following processes.
        1. Go to "Course C" homepage, and click "Import" from cog icon.
        2. Choose "Course A" in course selection, and click "Continue".
        3. Make sure "Include override permissions" is NOT ticked, and click "Jump to final step".
        4. Click "Continue".
      4. Confirm the "Course C" does NOT have 'enrol/manual:enrol' permission for role 'Non-editing teacher' as following processes.
        1. Click "More..." from cog icon.
        2. Click "Users", then click "Permissions" in the course administration page.
        3. Filter by 'enrol/manual:enrol'.
        4. Confirm 'Non-editing teacher' is in "Roles with permission".

      Test Restore

      1. Go to "Course A" homepage.
      2. Confirm the restored course with "Include override permissions"  has 'enrol/manual:enrol' permission for role 'Non-editing teacher' as following processes.
        1. Click "Restore"In the restore page, choose "Backup-A" and click "Restore".
        2. Confirm the "Include override permissions" is ON in Backup settings in "1. Confirm" section.
        3. Choose "Restore as a new course" in "2. Destination" section.
        4. Confirm "Include override permissions" option is available, and turn on for the option in "3. Settings" section.
        5. Confirm "Include override permissions" is ON in the restore settings in "5. Preview" section. Perform restore.
        6. Confirm the restored course has a override permission to 'enrol/manual:enrol' for role 'Non-editing teacher'.
      3. Confirm the restored course without "Include override permissions"  does NOT have 'enrol/manual:enrol' permission for role 'Non-editing teacher' as following processes.
        1. In the restore page, choose "Backup-A" and click "Restore".
        2. Same procedure as before, but untick the option in "3. Settings" section.
        3. Confirm "Include override permissions" is OFF in the restore settings in "5. Preview" section. Perform restore.
        4. Confirm the restored course does NOT have a override permission to 'enrol/manual:enrol' for role 'Non-editing teacher'
      Show
      Preparation Create 3 courses - A, B, and C. In the "Course A", make a override permission to 'enrol/manual:enrol' for role 'Non-editing teacher' as following processes. Go to "Course A" homepage, click "More..." from cog icon. Click "Users", then click "Permissions" in the course administration page. Filter by 'enrol/manual:enrol' , and add  'Non-editing teacher' to "Roles with permission". Create a backup ("Backup-A") from "Course A" as following processes. Go to "Course A" homepage, click "Backup" from cog icon. Click "Jump to final step". Click "Continue" to complete the backup. Test default settings In site administration page, search setting by "backup". Confirm "Include override permissions" options are in the category below, with NOTE: General import defaults (backup | backup_import_permissions), Default: No General restore defaults (restore | restore_general_permissions), Default: Yes Set "Include override permissions" for "General import defaults" OFF and "General restore defaults" ON from administration page. Confirm "Include override permissions" is OFF for "General import defaults" as following processes. Go to "Course B" homepage, and click "Import" from cog icon. Choose "Course A" in course selection, and click "Continue". Confirm "Include override permissions" is NOT selected . Confirm "Include override permissions" is ON for "General restore defaults" as following processes. Go to "Course A" homepage. Click "Restore" from cog icon. Click "Restore" from "Backup-A" in Unit backup area. Click "Continue" in "Confirm" section. Choose a category in "Restore as a new course", and click "Continue". Confirm "Include override permissions" is selected. Set "Include override permissions" for "General import defaults" ON and "General restore defaults" OFF from administration page. Confirm "Include override permissions" is ON for "General import defaults" as following processes.  Go to "Course B" homepage, and click "Import" from cog icon. Choose "Course A" in course selection, and click "Continue". Confirm "Include override permissions" is selected . Confirm "Include override permissions" is OFF for "General restore defaults" as following processes.  Go to "Course A" homepage. Click "Restore" from cog icon. Click "Restore" from "Backup-A" in Unit backup area. Click "Continue" in "Confirm" section. Choose a category in "Restore as a new course", and click "Continue". Confirm "Include override permissions" is NOT selected . Test Import Import from "Course A" to "Course B" as following processes. Go to "Course B" homepage, and click "Import" from cog icon. Choose "Course A" in course selection, and click "Continue". Make sure "Include override permissions" is ticked , and click "Jump to final step". Click "Continue". Confirm the "Course B" has 'enrol/manual:enrol' permission for role 'Non-editing teacher' as following processes. Click "More..." from cog icon. Click "Users", then click "Permissions" in the course administration page. Filter by 'enrol/manual:enrol'. Confirm 'Non-editing teacher' is in "Roles with permission". Import from "Course A" to "Course C" as following processes. Go to "Course C" homepage, and click "Import" from cog icon. Choose "Course A" in course selection, and click "Continue". Make sure "Include override permissions" is NOT ticked , and click "Jump to final step". Click "Continue". Confirm the "Course C" does NOT have 'enrol/manual:enrol' permission for role 'Non-editing teacher' as following processes. Click "More..." from cog icon. Click "Users", then click "Permissions" in the course administration page. Filter by 'enrol/manual:enrol'. Confirm 'Non-editing teacher' is in "Roles with permission". Test Restore Go to "Course A" homepage. Confirm the restored course with  "Include override permissions"  has 'enrol/manual:enrol' permission for role 'Non-editing teacher' as following processes. Click "Restore"In the restore page, choose "Backup-A" and click "Restore". Confirm the "Include override permissions" is ON in Backup settings in "1. Confirm" section. Choose "Restore as a new course" in "2. Destination" section. Confirm "Include override permissions" option is available, and turn on for the option in "3. Settings" section. Confirm "Include override permissions" is ON in the restore settings in "5. Preview" section. Perform restore. Confirm the restored course has a override permission to 'enrol/manual:enrol' for role 'Non-editing teacher' . Confirm the restored course without "Include override permissions"  does NOT have 'enrol/manual:enrol' permission for role 'Non-editing teacher' as following processes. In the restore page, choose "Backup-A" and click "Restore". Same procedure as before, but untick the option in "3. Settings" section. Confirm "Include override permissions" is OFF in the restore settings in "5. Preview" section. Perform restore. Confirm the restored course does NOT have a override permission to 'enrol/manual:enrol' for role 'Non-editing teacher'
    • Affected Branches:
      MOODLE_310_STABLE, MOODLE_311_STABLE, MOODLE_33_STABLE, MOODLE_37_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE
    • Fixed Branches:
      MOODLE_311_STABLE
    • Pull 3.11 Branch:
       MDL-63381_311_v3
    • Pull Master Branch:
       MDL-63381_master_v3

      Description

      When teacher imports part of course from their previous course Moodle also import user permissions without noticing teacher. It is bug and needs to be resolved right away.

      It's a design for import function. But it's better to have an option and warning when importing.

      Steps to reproduce:

      1. Prepare three users: the Good, the Bad and the Ugly.
      2. Prepare two courses - A and B.
      3. Make the Ugly a teacher in both courses.
      4. Make the Good a non-editing teacher in the course A.
      5. Make the Bad a non-editing teacher in the course B.
      6. Log in as the Ugly teacher.
      7. In the course A, override permissions for role 'Non-editing teacher' and give it for example the capability to enrol users ("enrol/manual:enrol") - because the Ugly teacher trusts the Good assistant and wants them to help with the course management.
      8. Add a resource (such as a page) in the course A.
      9. Go to the course B.
      10. Import the resource from A to B.
      11. Log in as the Bad non-editing teacher.
      • Expected result: the Bad non-editing teacher should not be able to enrol users in the course B.
      • Actual behaviour: the Bad non-editing teacher can enrol users (or whatever the Good one was given in the original course).

        Attachments

          Activity

            People

            Assignee:
            tomotsuyuki Tomo Tsuyuki
            Reporter:
            imatotek Ivica Matotek
            Peer reviewer:
            Mikhail Golenkov Mikhail Golenkov
            Integrator:
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Tester:
            Gladys Basiana Gladys Basiana
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
            Votes:
            9 Vote for this issue
            Watchers:
            16 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              17/May/21

                Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours, 45 minutes
                4h 45m