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

User without moodle/course:changesummary capability receives database error when saving course settings

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 2.0
    • None
    • Course
    • Any
    • MOODLE_20_STABLE

    Description

      Hi,

      The summaryformat field in the mdl_course table has a NOT NULL flag which causes a database error (dmlwriteexception) when a user without the course:changesummary capability updates a course via the course edit form. This error occurs because the summary_editor field which contains the summaryformat setting is removed from the course edit form with mform->hardFreeze(). The field is never re-added to the form data before saving resulting in the error.

      The summary_editor field is a complex array type which cannot be set via the mform->setConstant() function which is what occurs in the form definition when the user does not have permission to modify fullname, shortname, idnumber etc. I expect this may need to be fixed by either, removing the not-null constraint (although not sure exactly what the implications of this would be) or by simply adding the original value from existing course.

      Note that this also causes an undefined_property error when update_course calls file_postupdate_standard_editor($data, 'summary',... as this call implies summary_editor exists within the form data.

      We are currently looking to develop a patch and will hopefully have a suitable fix shortly. In the meantime any comments or suggestions would be appreciated.

      Luke

      Attachments

        Issue Links

          Activity

            People

              ankit_frenz Ankit Agarwal
              luketucker Luke Tucker
              Amaia Anabitarte, Carlos Escobedo, Laurent David, Mikel Martín Corrales, Sabina Abellan, Sara Arjona (@sarjona)
              Votes:
              7 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: