Browse files

MDL-29072 Import course: Use correct capability for course selection

  • Loading branch information...
1 parent b1e71da commit 1749c7aa314c9c5f486614b93d5f3d69fdbfd656 @bostelm bostelm committed with Sam Hemelryk Aug 23, 2011
Showing with 19 additions and 2 deletions.
  1. +10 −1 backup/util/ui/import_extensions.php
  2. +9 −1 backup/util/ui/restore_ui_components.php
View
11 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 {}
+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');
+ }
+}
View
10 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');
}
/**
*

0 comments on commit 1749c7a

Please sign in to comment.