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

This commit is contained in:
Henning Bostelmann 2011-08-23 17:50:23 +01:00
parent 4f3632441a
commit 96576a2ac1
2 changed files with 19 additions and 2 deletions

View File

@ -158,4 +158,13 @@ class import_ui_stage_final extends backup_ui_stage_final {}
/** /**
* Extends the restore course search to search for import courses. * 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 File

@ -226,9 +226,17 @@ class restore_course_search extends restore_search_base {
*/ */
public function __construct(array $config=array(), $currentcouseid = null) { public function __construct(array $config=array(), $currentcouseid = null) {
parent::__construct($config); parent::__construct($config);
$this->require_capability('moodle/restore:restorecourse'); $this->setup_restrictions();
$this->currentcourseid = $currentcouseid; $this->currentcourseid = $currentcouseid;
$this->includecurrentcourse = false; $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');
} }
/** /**
* *