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

Accessing a conditional hidden section via a url provides error message

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Log in as admin user
      2. Go to Site administration ► Advanced features
      3. Enable restricted access
      4. Create a test course
      5. Set format to topics or weeks
      6. Set course layout to one section at a time
      7. Enable completion tracking
      8. Add a quiz to the course and under activity completion set require grade to 'Student must receive a grade to complete this activity'
      9. Edit a section and restrict access to require completion of the quiz and also set 'Before section can be accessed' to 'Show section greyed out, with restriction information' (click the eye - but it should be this by default)
      10. Add more visible conditions
      11. Save section
      12. Log in as a student (or change roll to student)
      13. Manually navigate to the restricted section via the browser address bar - e.g.
        http://mymoodle/course/view.php?id=100&section=2
      14. You should see information about the section being restricted (e.g. "Not available until the activity solar system is marked complete.")
      15. Go back to the section settings
      16. In one of the access restrictions, click the eye so it's no longer visible
      17. As the student try to go to the url again
      18. You should see "Sorry, but you do not currently have permissions to do that (View hidden sections)"
      Show
      Log in as admin user Go to Site administration ► Advanced features Enable restricted access Create a test course Set format to topics or weeks Set course layout to one section at a time Enable completion tracking Add a quiz to the course and under activity completion set require grade to 'Student must receive a grade to complete this activity' Edit a section and restrict access to require completion of the quiz and also set 'Before section can be accessed' to 'Show section greyed out, with restriction information' (click the eye - but it should be this by default) Add more visible conditions Save section Log in as a student (or change roll to student) Manually navigate to the restricted section via the browser address bar - e.g. http://mymoodle/course/view.php?id=100&section=2 You should see information about the section being restricted (e.g. "Not available until the activity solar system is marked complete.") Go back to the section settings In one of the access restrictions, click the eye so it's no longer visible As the student try to go to the url again You should see "Sorry, but you do not currently have permissions to do that (View hidden sections)"
    • Affected Branches:
      MOODLE_26_STABLE, MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_32_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-45762-master

      Description

      Steps to reproduce

      0) Log in as admin user
      1) Create a test course
      2) Set format to topics or weeks
      3) Set course layout to one section at a time
      4) Enable completion tracking
      5) Add a quiz to the course and under activity completion set require grade to 'Student must receive a grade to complete this activity'
      6) Edit a section and restrict access to require completion of the quiz and also set 'Before section can be accessed' to 'Show section greyed out, with restriction information'
      7) Save section
      8) Log in as a student (or change roll to student)
      9) Manually navigate to the restricted section via the browser address bar - e.g.
      http://mymoodle/course/view.php?id=100&section=2

      Instead of seeing the information about the section being restricted (e.g. "Not available until the activity solar system is marked complete.") You will instead see the following message and some debug information

      "Sorry, but you do not currently have permissions to do that (View hidden sections)

      More information about this error

      Debug info:
      Error code: nopermissions
      Stack trace:
      line 786 of /lib/accesslib.php: required_capability_exception thrown
      line 144 of /course/view.php: call to require_capability()"

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  5/Dec/16