MDL-41266 move reader access control out from manager

We need to let reports decide if they want to use capability to access readers.
This commit is contained in:
Petr Skoda 2014-01-15 12:02:00 +08:00 committed by Petr Škoda
parent 53dd210aff
commit ecf9a0c5a6
3 changed files with 5 additions and 10 deletions

View File

@ -94,16 +94,13 @@ class manager implements \core\log\manager {
*
* This way the reports find out available sources of data.
*
* @param \context $context
* @return \core\log\reader[] list of available log data readers
*/
public function get_readers(\context $context) {
public function get_readers() {
$this->init();
$return = array();
foreach ($this->readers as $plugin => $reader) {
if ($reader->can_access($context)) {
$return[$plugin] = $reader;
}
$return[$plugin] = $reader;
}
return $return;
}

View File

@ -28,7 +28,7 @@ namespace core\log;
defined('MOODLE_INTERNAL') || die();
class dummy_manager implements manager {
public function get_readers(\context $context) {
public function get_readers() {
return array();
}
public function dispose() {

View File

@ -36,13 +36,11 @@ defined('MOODLE_INTERNAL') || die();
*/
interface manager {
/**
* Return list of available log readers in given
* context for current user.
* Return list of available log readers.
*
* @param \context $context
* @return \core\log\reader[]
*/
public function get_readers(\context $context);
public function get_readers();
/**
* Dispose all initialised stores.