Details
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
- is duplicated by
-
MDL-29239 Users without moodle/course:changesummary permission can not edit other course fields
-
- Closed
-