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

Count of exported questions can be wrong

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.4.5, 3.5.2, 3.5.4, 3.6.3
    • Fix Version/s: None
    • Component/s: Questions
    • Labels:
    • Affected Branches:
      MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE
    • Pull Master Branch:
    • Testing Instructions:
      Hide

      You need a course with some questions in the course question bank and an editing teacher enrolled in that course.

      Go to Site Administration Users Permissions Define roles and uncheck the Allow for the question:viewall permission of the Teacher role.

      Verify that without this patch when you login as the editing teacher and try to export questions using the Gift format, you get a rather cryptic error "Sorry, the requested file could not be found"

      Redo the same process after applying this patch. Verify that this time you get the error message "No questions were found that could be exported. Make sure that you have selected a category to export that contains questions."

      Show
      You need a course with some questions in the course question bank and an editing teacher enrolled in that course. Go to Site Administration Users Permissions Define roles and uncheck the Allow for the question:viewall permission of the Teacher role. Verify that without this patch when you login as the editing teacher and try to export questions using the Gift format, you get a rather cryptic error "Sorry, the requested file could not be found" Redo the same process after applying this patch. Verify that this time you get the error message "No questions were found that could be exported. Make sure that you have selected a category to export that contains questions."

      Description

      In question/format.php the increment $count++; is outside of the if (!$checkcapabilities || question_has_capability_on($question, 'view'))  test. this can makes the count of exported questions wrong if the user don't have the view permission on some questions, in fact it is even possible that no questions are in the export file but the process continue as if the file was not empty.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              jmvedrine Jean-Michel Vedrine
              Participants:
              Component watchers:
              Tim Hunt, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: