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

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.0
    • Fix Version/s: None
    • Component/s: Course
    • Labels:
    • Database:
      Any
    • Affected Branches:
      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

              Assignee:
              ankit_frenz Ankit Agarwal
              Reporter:
              luketucker Luke Tucker
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              Votes:
              7 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: