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

Capability "backuptargetimport" should have captype "read"

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Turn on context freezing (Site admin > Development > Experimental features).
      2. Create a category (CAT1) with a course (C1) in it (including some course content, such as an assignment), and enrol a teacher (t1).
      3. Create another category (CAT2), outside the previous one, with a course (C2) in it and enrol a teacher (t1).
      4. Freeze the category CAT1 (Site admin > Manage courses and categories > cog next to category).
      5. Login as teacher t1.
      6. Go to C2.
      7. Start an import.
      8. Search for the C1 frozen course.
      9. Check the frozen course C1 appears in the list of import sources and allows content to be imported into the regular course.
      10. Check the content in course C1 is imported to C2.
      Show
      Turn on context freezing (Site admin > Development > Experimental features). Create a category (CAT1) with a course (C1) in it (including some course content, such as an assignment), and enrol a teacher (t1). Create another category (CAT2), outside the previous one, with a course (C2) in it and enrol a teacher (t1). Freeze the category CAT1 (Site admin > Manage courses and categories > cog next to category). Login as teacher t1. Go to C2. Start an import. Search for the C1 frozen course. Check the frozen course C1 appears in the list of import sources and allows content to be imported into the regular course. Check the content in course C1 is imported to C2.
    • Affected Branches:
      MOODLE_38_STABLE
    • Fixed Branches:
      MOODLE_38_STABLE
    • Pull 3.8 Branch:
      m38_MDL-67497
    • Pull Master Branch:
      master_MDL-67497

      Description

      To import content from one course to another requires two capabilities. The user must have "backuptargetimport" in the source course and "restoretargetimport" in the destination course. The capabililty "backuptargetimport" has a captype "write", which usually doesn't matter, but when the source course is in frozen context, all write capabilities are disallowed; therefore people cannot import from a frozen course, even when they have the capability to do so. I contest that people should be able to import from a read-only, frozen course into an active course and that creating a backup to import is not a write action where restoring the backup in an import is writing.

      I'm not sure if there are wider implications of changing this capability to a "read" captype, but when I made this change (and flushed caches), importing worked as expected from a frozen course and the world didn't end.

      In Dev chat, Marina suggested this was a bug, so I am reporting it here.

       

      Replication steps...

      1. Turn on context freezing (Site admin > Developement > Experimental features)
      2. Create a category with a course in it (including some course content)
      3. Freeze the category (Site admin > Manage courses and categories > cog next to category)
      4. Go to a course outside the frozen category using a user who is a teacher in the frozen course and the regular course.
      5. Start an import

      Expected result

      • The frozen course appears in the list of import sources and allows content to be imported into the regular course.

      Actual result

      • The frozen course is not given as a source course.

      Changing the captype of "backuptargetimport" to "read" allows the expected result.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              danmarsden Dan Marsden
              Reporter:
              salvetore Michael de Raadt
              Peer reviewer:
              Simey Lameze
              Integrator:
              Sara Arjona (@sarjona)
              Tester:
              Janelle Barcega
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                13/Jul/20

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour, 50 minutes
                  1h 50m