Core hack to allow course creators to search for courses to be imported

Core hack to allow course creators to search for courses to be imported

by David Bogner -
Number of replies: 0
Picture of Core developers Picture of Plugin developers
Hi,

we have a hugh moodle installation with many courses and where the users can exchange and import courses from other users. There is just one problem:

Course-Admin->Import does not display the search box for course creators of the course category where all courses can be exchange. (And the dropdown list is already too long to scroll)

I figured out why: in course/import/activities/mod.php (http://xref.moodle.org/course/import/activities/mod.php.source.html) only a systemwide course creator can search for courses and not a course creator assigned to a course category.:
 10 $syscontext = get_context_instance(CONTEXT_SYSTEM);
 11
 12  // if we're not a course creator , we can only import from our own courses.
 13 if (has_capability('moodle/course:create', $syscontext)) {
 14 $creator = true;
 15 }

So if I replace CONTEXT_SYSTEM with CONTEXT_COURSECAT (so it will check if the user has course creator capability for this course category)do I risk any security issue? Or is this safe?

This change would affect some 1000 Moodle installations, so it would be good to have an expert opinion on that change.

Thanks for your help
David

Average of ratings: -