From 96576a2ac128ebfda9b4fe403286775b4bc6ab5e Mon Sep 17 00:00:00 2001 From: Henning Bostelmann Date: Tue, 23 Aug 2011 17:50:23 +0100 Subject: [PATCH] MDL-29072 Import course: Use correct capability for course selection --- backup/util/ui/import_extensions.php | 11 ++++++++++- backup/util/ui/restore_ui_components.php | 10 +++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/backup/util/ui/import_extensions.php b/backup/util/ui/import_extensions.php index b4f9068dc49..9fe31bb8745 100644 --- a/backup/util/ui/import_extensions.php +++ b/backup/util/ui/import_extensions.php @@ -158,4 +158,13 @@ class import_ui_stage_final extends backup_ui_stage_final {} /** * Extends the restore course search to search for import courses. */ -class import_course_search extends restore_course_search {} \ No newline at end of file +class import_course_search extends restore_course_search { + /** + * Sets up any access restrictions for the courses to be displayed in the search. + * + * This will typically call $this->require_capability(). + */ + protected function setup_restrictions() { + $this->require_capability('moodle/backup:backuptargetimport'); + } +} \ No newline at end of file diff --git a/backup/util/ui/restore_ui_components.php b/backup/util/ui/restore_ui_components.php index 5daf231cbac..85c61c8ab5a 100644 --- a/backup/util/ui/restore_ui_components.php +++ b/backup/util/ui/restore_ui_components.php @@ -226,9 +226,17 @@ class restore_course_search extends restore_search_base { */ public function __construct(array $config=array(), $currentcouseid = null) { parent::__construct($config); - $this->require_capability('moodle/restore:restorecourse'); + $this->setup_restrictions(); $this->currentcourseid = $currentcouseid; $this->includecurrentcourse = false; + } + /** + * Sets up any access restrictions for the courses to be displayed in the search. + * + * This will typically call $this->require_capability(). + */ + protected function setup_restrictions() { + $this->require_capability('moodle/restore:restorecourse'); } /** *