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

Problem editing questions with a strange combination of permissions

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.6.2, 2.7, 2.8
    • Fix Version/s: 2.6.5, 2.7.2
    • Component/s: Questions
    • Labels:
    • Testing Instructions:
      Hide

      You need a course containing at least on question in the question bank.

      (Note, there were merge conflicts applying the fix to the 2.6 branch. Please test that carefully. Thanks. Note: it worked for me.)

      1. Define a new role 'Edit questions', assignable in course contexts, with these capabilities set to Allow, and no others (especially not moveall):
        • moodle/question:editall
        • moodle/question:editmine
        • moodle/question:movemine
        • moodle/question:useall
        • moodle/question:usemine
        • moodle/question:viewall
        • moodle/question:viewmine
      2. Login as teacher verify that you can edit and save a question in your test course, and also add a new question. (This is just a quick test of the normal case, to help verifly that while fixing he obscure edge case, we did not obviously break anything.)
      3. Enrol a user in your test course and give them two roles, 'Student' and 'Edit questions'.
      4. Log in as that user. Go to the question bank in the test course.
      5. Click the edit icon by a question.
      6. On the editing form, make some change that you will be able to recognise later.
      7. Click Save changes, and verify that the form submits.
      8. Re-edit the question, and verify that the changes were saved.
      Show
      You need a course containing at least on question in the question bank. (Note, there were merge conflicts applying the fix to the 2.6 branch. Please test that carefully. Thanks. Note: it worked for me.) Define a new role 'Edit questions', assignable in course contexts, with these capabilities set to Allow, and no others (especially not moveall): moodle/question:editall moodle/question:editmine moodle/question:movemine moodle/question:useall moodle/question:usemine moodle/question:viewall moodle/question:viewmine Login as teacher verify that you can edit and save a question in your test course, and also add a new question. ( This is just a quick test of the normal case, to help verifly that while fixing he obscure edge case, we did not obviously break anything. ) Enrol a user in your test course and give them two roles, 'Student' and 'Edit questions'. Log in as that user. Go to the question bank in the test course. Click the edit icon by a question. On the editing form, make some change that you will be able to recognise later. Click Save changes, and verify that the form submits. Re-edit the question, and verify that the changes were saved.
    • Affected Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      Steps to reproduce

      1. Define a new role 'Editquestions', assignable in course contexts, with these capabilities set to Allow, and no others

      • moodle/question:editall
      • moodle/question:editmine
      • moodle/question:movemine
      • moodle/question:useall
      • moodle/question:usemine
      • moodle/question:viewall
      • moodle/question:viewmine

      2. In a course which has at least one multiple choice question in the question bank, enrol a user as a Student, and then also give them the 'Editquestions' role.

      3. Log in as that user. Go to the question bank.

      4. Click the edit icon by the mulitple choice question.

      5. On the editing form, make some change that you will be able to recognise later.

      6. Click Save changes.

      Expected result: the changes are saved.

      Acutal result: the form reloads, as if there is a validation error, but no errors are displayed. The changes are not saved.

      What is going on behind the scenes is that question_edit_form::validation is generating a validation error behind the scenes, but associated with a non-existant form field, which is why no validation messages are visible.

      It appears this problem has been there since 2008. See MDL-14676 / https://github.com/moodle/moodle/commit/3efbe6bc891edf9fcf40a09c7a4f89e1b73467cc. The logic added there is wrong.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                8/Sep/14