Replaced creator() calls with has_capability()
This commit is contained in:
@@ -23,13 +23,14 @@
|
||||
require_login($course->id);
|
||||
$tocontext = get_context_instance(CONTEXT_COURSE, $id);
|
||||
$fromcontext = get_context_instance(CONTEXT_COURSE, $fromcourse);
|
||||
$syscontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
|
||||
if (!has_capability('moodle/course:manageactivities', $tocontext)) {
|
||||
error("You need do not have the required permissions to import activities to this course");
|
||||
}
|
||||
|
||||
// if we're not a course creator , we can only import from our own courses.
|
||||
if (iscreator()) {
|
||||
if (has_capability('moodle/course:create', $syscontext)) {
|
||||
$creator = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,11 @@
|
||||
|
||||
require_once($CFG->dirroot.'/course/lib.php');
|
||||
require_once($CFG->dirroot.'/backup/restorelib.php');
|
||||
|
||||
$syscontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||
|
||||
// if we're not a course creator , we can only import from our own courses.
|
||||
if (iscreator()) {
|
||||
if (has_capability('moodle/course:create', $syscontext)) {
|
||||
$creator = true;
|
||||
}
|
||||
|
||||
@@ -101,4 +103,4 @@
|
||||
|
||||
print_table($table);
|
||||
|
||||
?>
|
||||
?>
|
||||
Reference in New Issue
Block a user