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

Add the capability tool/uploadcourse:use for tool_uploadcourse

    XMLWordPrintable

Details

    • MOODLE_26_STABLE, MOODLE_27_STABLE, MOODLE_29_STABLE, MOODLE_311_STABLE, MOODLE_32_STABLE, MOODLE_33_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE, MOODLE_401_STABLE, MOODLE_402_STABLE, MOODLE_404_STABLE
    • MOODLE_404_STABLE
    • MDL-43056-main
    • Hide

      Testing scenario

      1. Login as admin
      2. Create a new category (Home ► Site administration ► Courses ► Add a category). It should have the id = 2, if not, please change the category ids in the provided test files (csv).
      3. Go to upload courses (Home ► Site administration ► Courses ► Upload courses) and upload the first file (upload_test.csv) - Note: change separator to ';' for the upload to work correctly.
      4. Complete the upload process and verify all went correct.
      5. Assign a second user the manager system role (Home ► Site administration ► Users ► Permissions ► Assign system roles).
      6. Login with this account.
      7. Go again to the Upload courses page and upload the second file (upload_test2.csv) - Note: change separator to ';' for the upload to work correctly.
      8. Complete the upload process and verify all went correct.
      9. Change the permission for the 'tool/uploadcourse:use' capability on the newly created category. (Home ► Site administration ► Courses ► Manage courses and categories). Set the permission to 'Prohibit' for the role Manager.
      10. Try again to upload the course file (upload_test3.csv) - Note: change separator to ';' for the upload to work correctly.
      11. Verify there should be an error on the creation of the course in the second category, but complete the upload courses process anyway.
      12. Please do the rollback done on step 9 and give the permissions back on this course category for the role Manager.
      13. Repeat step 10, but providing another file (upload_test4.csv) Note: change separator to ';' for the upload to work correctly.
      14. Finish the Upload process and verify that both courses were created without throwing an error.
      Show
      Testing scenario Login as admin Create a new category (Home ► Site administration ► Courses ► Add a category). It should have the id = 2, if not, please change the category ids in the provided test files (csv). Go to upload courses (Home ► Site administration ► Courses ► Upload courses) and upload the first file (upload_test.csv) - Note: change separator to ';' for the upload to work correctly. Complete the upload process and verify all went correct. Assign a second user the manager system role (Home ► Site administration ► Users ► Permissions ► Assign system roles). Login with this account. Go again to the Upload courses page and upload the second file (upload_test2.csv) - Note: change separator to ';' for the upload to work correctly. Complete the upload process and verify all went correct. Change the permission for the 'tool/uploadcourse:use' capability on the newly created category. (Home ► Site administration ► Courses ► Manage courses and categories). Set the permission to 'Prohibit' for the role Manager. Try again to upload the course file (upload_test3.csv) - Note: change separator to ';' for the upload to work correctly. Verify there should be an error on the creation of the course in the second category, but complete the upload courses process anyway. Please do the rollback done on step 9 and give the permissions back on this course category for the role Manager. Repeat step 10, but providing another file (upload_test4.csv) Note: change separator to ';' for the upload to work correctly. Finish the Upload process and verify that both courses were created without throwing an error.
    • 6
    • Moppies Kanban, Team Hedgehog 2023 Sprint 4.2, Team Hedgehog 2023 Sprint 4.3, Team Hedgehog 2023 Review 4

    Description

      With the new functionality of uploading courses via csv, I cannot see how to enable managers to upload courses in the same way as they can upload users. There is a moodle/site:uploadusers capability so would it be helpful to have a moodle/site:uploadcourses capability? (Otherwise how can managers perform this action?)

      Update about the implementation (and why it took so long)

      Before this issue, the uploadcourse tool was not checking any capabilities at all (for example, create/update/restore courses, modify idnumber or summary, assign roles). It was assuming that the current user is a super-user and can do everything. Apart from it there were a lot of missing checks about creating enrolment methods. The work on enrolment methods was so big that it was split from this issue, see linked issues.

      In order to allow non-admin users to use the uploadcourse tool we had to first improve validation and permission checks inside the tool. With this patch anybody with the capability 'tool/uploadcourse:use' will be able to access the uploadcourse tool but they still need all other capabilities such as 'moodle/course:create', 'moodle/course:update', 'moodle/course:delete', etc in order to create/update/delete courses

      Attachments

        1. (1) 11 Passed -- (Main)MDL-43056.png
          (1) 11 Passed -- (Main)MDL-43056.png
          72 kB
        2. (1) 14 Passed -- (Main)MDL-43056.png
          (1) 14 Passed -- (Main)MDL-43056.png
          52 kB
        3. (1) 4 Passed -- (Main)MDL-43056.png
          (1) 4 Passed -- (Main)MDL-43056.png
          49 kB
        4. (1) 8 Passed -- (Main)MDL-43056.png
          (1) 8 Passed -- (Main)MDL-43056.png
          48 kB
        5. cat heading.png
          cat heading.png
          71 kB
        6. correct_overview.png
          correct_overview.png
          13 kB
        7. error_no_permission.png
          error_no_permission.png
          17 kB
        8. MDL-43056.txt
          4 kB
        9. MDL-43056-site.txt
          3 kB
        10. Screenshot 2019-07-25 at 11.04.21.png
          Screenshot 2019-07-25 at 11.04.21.png
          125 kB
        11. upload_test.csv
          0.1 kB
        12. upload_test2.csv
          0.1 kB
        13. upload_test3.csv
          0.1 kB
        14. upload_test4.csv
          0.1 kB

        Issue Links

          Activity

            People

              Votes:
              72 Vote for this issue
              Watchers:
              73 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

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

                  Clockify

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