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

mod_subsection: Adding fails despite having sufficient capabilities

    • MOODLE_405_STABLE, MOODLE_500_STABLE
    • MDL-85020-MOODLE_405_STABLE
    • MDL-85020-main
    • Hide

      Testing instructions:
      To reproduce:

      1. Create a new role "author" with archetype "student" available on course context
      2. Set moodle/course:manageactivities to "Permit" for this role
      3. Set mod/subsection:addinstance to "Permit" for this role
      4. Verify that the "author" role does NOT have the capability moodle/course:update
      5. Create a new user with username "authoruser"
      6. Enrol the user "authoruser" into a course
      7. Assign the role "author" role to the user "authoruser"
      8. As admin enable the mod_subsection activity plugin
      9. As "authoruser" go to the course, enable edit mode and add a subsection
      10. Confirm that the subsection has been created without an error being shown
      Show
      Testing instructions: To reproduce: Create a new role "author" with archetype "student" available on course context Set moodle/course:manageactivities to "Permit" for this role Set mod/subsection:addinstance to "Permit" for this role Verify that the "author" role does NOT have the capability moodle/course:update Create a new user with username "authoruser" Enrol the user "authoruser" into a course Assign the role "author" role to the user "authoruser" As admin enable the mod_subsection activity plugin As "authoruser" go to the course, enable edit mode and add a subsection Confirm that the subsection has been created without an error being shown
    • Hide

      Code verified against automated checks.

      Checked MDL-85020 using repository: https://github.com/phmemmel/moodle.git

      More information about this report

      Built on: Wed Mar 26 12:59:34 UTC 2025

      Show
      Code verified against automated checks. Checked MDL-85020 using repository: https://github.com/phmemmel/moodle.git MOODLE_405_STABLE (0 errors / 0 warnings) [branch: MDL-85020-MOODLE_405_STABLE | CI Job ] main (0 errors / 0 warnings) [branch: MDL-85020-main | CI Job ] More information about this report Built on: Wed Mar 26 12:59:34 UTC 2025

      To reproduce:

      • Create an "author" role based on student role on course context
      • Set moodle/course:manageactivities to "Permit"
      • Set mod/subsection:addinstance to "Permit"
      • Verify that the "author" role does NOT have the capability moodle/course:update
      • Enrol a user "authoruser" into a course, assign the "author" role to him
      • As admin enable the mod_subsection plugin
      • As "authoruser" go to the course, enable edit mode and try to add a subsection
      • It will fail due to missing capability moodle/course:update

      This exception is being thrown in course/format/classes/stateactions.php in method create_module. For creating a module however, for my understanding, not the capability moodle/course:update but the capability moodle/course:manageactivities should be required.

        1. screenshot-1.png
          screenshot-1.png
          44 kB
        2. screenshot-2.png
          screenshot-2.png
          64 kB
        3. screenshot-3.png
          screenshot-3.png
          91 kB
        4. screenshot-4.png
          screenshot-4.png
          103 kB

            phmemmel PhMemmel
            phmemmel PhMemmel
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

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