diff --git a/backup/backup_execute.html b/backup/backup_execute.html index 4276c885be3..dabed9e04df 100644 --- a/backup/backup_execute.html +++ b/backup/backup_execute.html @@ -9,7 +9,7 @@ if (empty($to)) { error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); } else { - if (!isteacheredit($to)) { + if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $to))) { error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); } } diff --git a/backup/restore_check.html b/backup/restore_check.html index e97182335fa..fb1dba3637b 100644 --- a/backup/restore_check.html +++ b/backup/restore_check.html @@ -175,7 +175,7 @@ print_heading(get_string("choosecourse")); print_simple_box_start("center"); foreach ($courses as $course) { - if (!isteacheredit($course->id)) { + if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $course->id))) { continue; } if (empty($course->visible)) { @@ -195,7 +195,7 @@ //Final access control check if ($restore->course_id == 0 and !has_capability('moodle/course:create', get_context_instance(CONTEXT_SYSTEM, SITEID))) { error("You need to be a creator or admin to restore into new course!"); - } else if ($restore->course_id != 0 and !isteacheredit($restore->course_id)) { + } else if ($restore->course_id != 0 and !has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $restore->course_id))) { error("You need to be an edit teacher or admin to restore into selected course!"); } $show_continue_button = true; diff --git a/blocks/news_items/block_news_items.php b/blocks/news_items/block_news_items.php index ac8cdb0e5e6..f23d30d0bc8 100644 --- a/blocks/news_items/block_news_items.php +++ b/blocks/news_items/block_news_items.php @@ -35,7 +35,7 @@ class block_news_items extends block_base { /// First work out whether we can post to this group and if so, include a link - if (isteacheredit($COURSE->id)) { /// Teachers can always post + if (has_capability('moodle/site:accessallgroups', get_context_instance(CONTEXT_COURSE, $COURSE->id))) { /// Teachers can always post $visiblegroups = -1; $text .= '