Moodle
  1. Moodle
  2. MDL-33937

Student can see completion information for a section even if settings are set to hide the section

    Details

    • Testing Instructions:
      Hide

      1. Set up a course with 'one section per page' option.
      2. Edit one section option and set it to have a date in the future and to "hide section entirely".
      3. Log in as student and access the hidden section by editing the url from a normal section.

      Expected: Should give error message because section is not available.

      Show
      1. Set up a course with 'one section per page' option. 2. Edit one section option and set it to have a date in the future and to "hide section entirely". 3. Log in as student and access the hidden section by editing the url from a normal section. Expected: Should give error message because section is not available.
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull Master Branch:
      MDL-33937-master
    • Rank:
      42043

      Description

      Replication steps:-

      1. Set restriction on a section based on some activity completion. Make sure you set it to "hide section entirely"
      2. Login as student and visit any section page.
      3. Try to access the hidden section by editing the url
      4. You can see the restriction information, which should not be visible.

        Issue Links

          Activity

          Hide
          Dan Poltawski added a comment -

          This is activity completion, assigning to Sam

          Show
          Dan Poltawski added a comment - This is activity completion, assigning to Sam
          Hide
          Dan Poltawski added a comment -

          (maybe we need a new component)

          Show
          Dan Poltawski added a comment - (maybe we need a new component)
          Hide
          Sam Marshall added a comment -

          I'd argue this bug is actually with multipage course formats...!

          Here is code that fixes it by checking that sections are visible to current user before it lets you see them. This code also improves performance by replacing one unnecessary database query with data from modinfo.

          I suspect this change is not sufficient to make the multipage course format work correctly with hidden sections, for example there are still links to the hidden section which doesn't seem ideal.

          Show
          Sam Marshall added a comment - I'd argue this bug is actually with multipage course formats...! Here is code that fixes it by checking that sections are visible to current user before it lets you see them. This code also improves performance by replacing one unnecessary database query with data from modinfo. I suspect this change is not sufficient to make the multipage course format work correctly with hidden sections, for example there are still links to the hidden section which doesn't seem ideal.
          Hide
          Aparup Banerjee added a comment -

          this was up or peer-review, so looking..

          Show
          Aparup Banerjee added a comment - this was up or peer-review, so looking..
          Hide
          Aparup Banerjee added a comment -

          this looks good to me.

          just wondering if maybe there should be a case for IGNORE_MULTIPLE in get_section_info() for an exception?

          Show
          Aparup Banerjee added a comment - this looks good to me. just wondering if maybe there should be a case for IGNORE_MULTIPLE in get_section_info() for an exception?
          Hide
          Sam Marshall added a comment -

          Thanks for review!

          Because I wasn't sure, I now checked what IGNORE_MULTIPLE does if there are no results; it is the same as IGNORE_MISSING (i.e. returns false), so I think this behaviour is consistent.

          (Arguably it would be pretty silly for developers to specify IGNORE_MULTIPLE for $sttrictness, as it isn't a database query directly and there is no possibility of multiple results, but I don't think it's worth actively checking for that; they could also specify 78 or 'sausage' for that matter

          Submitting for integration review.

          Show
          Sam Marshall added a comment - Thanks for review! Because I wasn't sure, I now checked what IGNORE_MULTIPLE does if there are no results; it is the same as IGNORE_MISSING (i.e. returns false), so I think this behaviour is consistent. (Arguably it would be pretty silly for developers to specify IGNORE_MULTIPLE for $sttrictness, as it isn't a database query directly and there is no possibility of multiple results, but I don't think it's worth actively checking for that; they could also specify 78 or 'sausage' for that matter Submitting for integration review.
          Hide
          Dan Poltawski added a comment -

          Ha, I agree this was my bug (multi-page course format). Ooops!

          Show
          Dan Poltawski added a comment - Ha, I agree this was my bug (multi-page course format). Ooops!
          Hide
          Dan Poltawski added a comment -

          Integrated to 23_STABLE and master, thanks Sam.

          (actually, didn't conditional sections land afterwards )

          Show
          Dan Poltawski added a comment - Integrated to 23_STABLE and master, thanks Sam. (actually, didn't conditional sections land afterwards )
          Hide
          Sam Marshall added a comment -

          dan - yes, conditional sections landed afterwards even though they were ready months earlier, and apparently I am still sore about that

          thanks.

          Show
          Sam Marshall added a comment - dan - yes, conditional sections landed afterwards even though they were ready months earlier, and apparently I am still sore about that thanks.
          Hide
          Ankit Agarwal added a comment -

          Works as expected!
          Thanks

          Show
          Ankit Agarwal added a comment - Works as expected! Thanks
          Hide
          Sam Hemelryk added a comment -

          Congratulations your code is upstream - gold star for you!

          This issue + 79 others made it in in time for the minor releases.
          Thank you everyone involved for your exuberant efforts.

          Show
          Sam Hemelryk added a comment - Congratulations your code is upstream - gold star for you! This issue + 79 others made it in in time for the minor releases. Thank you everyone involved for your exuberant efforts.

            People

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

              Dates

              • Created:
                Updated:
                Resolved: