MDLSITE-361, it's possible to get into a strange situation when:
- restrictmodulesfor is enabled for some courses and
- some defaultallowedmodules are defined
In this case, when editing the settings of a course, the $course->restrict flag is switched ON automatically, even though an ordinary teacher can't see the setting in the form. Unfortunately, the default modules aren't set as well, so the course gets into a state where there's nothing in the add menus for the course (all modules are banned).