mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Replaced creator() calls with has_capability()
This commit is contained in:
parent
9f5c1e1057
commit
f8a6c19d23
2 changed files with 6 additions and 3 deletions
|
@ -23,13 +23,14 @@
|
||||||
require_login($course->id);
|
require_login($course->id);
|
||||||
$tocontext = get_context_instance(CONTEXT_COURSE, $id);
|
$tocontext = get_context_instance(CONTEXT_COURSE, $id);
|
||||||
$fromcontext = get_context_instance(CONTEXT_COURSE, $fromcourse);
|
$fromcontext = get_context_instance(CONTEXT_COURSE, $fromcourse);
|
||||||
|
$syscontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||||
|
|
||||||
if (!has_capability('moodle/course:manageactivities', $tocontext)) {
|
if (!has_capability('moodle/course:manageactivities', $tocontext)) {
|
||||||
error("You need do not have the required permissions to import activities to this course");
|
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 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;
|
$creator = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,11 @@
|
||||||
|
|
||||||
require_once($CFG->dirroot.'/course/lib.php');
|
require_once($CFG->dirroot.'/course/lib.php');
|
||||||
require_once($CFG->dirroot.'/backup/restorelib.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 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;
|
$creator = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,4 +103,4 @@
|
||||||
|
|
||||||
print_table($table);
|
print_table($table);
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Add table
Add a link
Reference in a new issue