Replaced creator() calls with has_capability()

This commit is contained in:
vyshane 2006-08-15 09:45:11 +00:00
parent 9f5c1e1057
commit f8a6c19d23
2 changed files with 6 additions and 3 deletions

View file

@ -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;
}

View file

@ -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);
?>
?>