MDL-62351 privacy: check that subsystem/plugintype exist

This commit is contained in:
Marina Glancy
2018-05-09 17:37:31 +08:00
parent 02c7769422
commit 468c8d39c3
4 changed files with 15 additions and 3 deletions
+1 -1
View File
@@ -72,7 +72,7 @@ class provider implements
// coursemoduleid, courseid, moduleid, groupid, rating, usermodified.
], 'privacy:metadata:post');
$collection->link_subsystem('core_comments', 'privacy:metadata:core_comments');
$collection->link_subsystem('core_comment', 'privacy:metadata:core_comments');
$collection->link_subsystem('core_files', 'privacy:metadata:core_files');
$collection->link_subsystem('core_tag', 'privacy:metadata:core_tag');
+1 -1
View File
@@ -211,7 +211,7 @@ class provider implements
], 'privacy:metadata:competency_userevidencecomp');
// Comments can be left on learning plans and competencies.
$collection->link_subsystem('core_comments', 'privacy:metadata:core_comments');
$collection->link_subsystem('core_comment', 'privacy:metadata:core_comments');
return $collection;
}
@@ -59,7 +59,7 @@ class provider implements metadataprovider, assignfeedback_provider {
];
$collection->add_database_table('assignfeedback_editpdf_quick', $quickdata, 'privacy:metadata:tablepurpose');
$collection->add_subsystem_link('core_files', [], 'privacy:metadata:filepurpose');
$collection->add_subsystem_link('core_fileconverted', [], 'privacy:metadata:conversionpurpose');
$collection->add_subsystem_link('core_fileconverter', [], 'privacy:metadata:conversionpurpose');
return $collection;
}
+12
View File
@@ -128,6 +128,18 @@ class provider_testcase extends advanced_testcase {
$this->assertTrue($DB->get_manager()->table_exists($item->get_name()));
}
if ($item instanceof \core_privacy\local\metadata\types\plugintype_link) {
// Check that plugin type is valid.
$this->assertTrue(array_key_exists($item->get_name(), \core_component::get_plugin_types()));
}
if ($item instanceof subsystem_link) {
// Check that core subsystem exists.
list($plugintype, $pluginname) = \core_component::normalize_component($item->get_name());
$this->assertEquals('core', $plugintype);
$this->assertTrue(\core_component::is_core_subsystem($pluginname));
}
if ($summary = $item->get_summary()) {
// Summary is optional, but when provided must be a valid string identifier.
$this->assertInternalType('string', $summary);