mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 01:16:44 +02:00
"MDL-19181, display plugin instances based on capabilities"
This commit is contained in:
parent
68bd9e5e13
commit
c86dde2ec5
66 changed files with 584 additions and 39 deletions
|
@ -623,6 +623,7 @@ abstract class repository {
|
|||
$is_supported = true;
|
||||
|
||||
$repository = new $classname($repo->id, $repo->contextid, $options, $repo->readonly);
|
||||
$context = get_context_instance_by_id(CONTEXT_SYSTEM, $repo->contextid);
|
||||
if (empty($repository->super_called)) {
|
||||
debugging('parent::__construct must be called by '.$repo->repositorytype.' plugin.');
|
||||
} else {
|
||||
|
@ -645,7 +646,8 @@ abstract class repository {
|
|||
if (!$onlyvisible || ($repository->is_visible() && !$repository->disabled)) {
|
||||
// super_called will make sure the parent construct function is called
|
||||
// by repository construct function
|
||||
if ($is_supported) {
|
||||
$capability = has_capability('repository/'.$repo->repositorytype.':view', $context, $USER->id, false);
|
||||
if ($is_supported && $capability) {
|
||||
$ret[] = $repository;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue