From 63ca7583d622e5a4d48a3bda0af7ffd61466c969 Mon Sep 17 00:00:00 2001 From: Adrian Greeve Date: Wed, 24 Oct 2018 14:33:44 +0800 Subject: [PATCH] MDL-63566 tool_dataprivacy: New interface check for userlist. This adds another check to see if the plugins are implementing the new core_userlist_provider. --- admin/tool/dataprivacy/classes/metadata_registry.php | 9 ++++++++- admin/tool/dataprivacy/lang/en/tool_dataprivacy.php | 2 ++ .../tool/dataprivacy/templates/component_status.mustache | 3 +++ .../templates/data_registry_compliance.mustache | 2 ++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/admin/tool/dataprivacy/classes/metadata_registry.php b/admin/tool/dataprivacy/classes/metadata_registry.php index 96c9e55bb2841..3d25904188e7b 100644 --- a/admin/tool/dataprivacy/classes/metadata_registry.php +++ b/admin/tool/dataprivacy/classes/metadata_registry.php @@ -77,14 +77,21 @@ public function get_registry_metadata() { $internaldata['external'] = true; } - // Check if the interface is deprecated. + // Additional interface checks. if (!$manager->is_empty_subsystem($component)) { $classname = $manager->get_provider_classname_for_component($component); if (class_exists($classname)) { $componentclass = new $classname(); + // Check if the interface is deprecated. if ($componentclass instanceof \core_privacy\local\deprecated) { $internaldata['deprecated'] = true; } + + // Check that the userlist provider is implemented. + if ($componentclass instanceof \core_privacy\local\request\core_user_data_provider + && !$componentclass instanceof \core_privacy\local\request\core_userlist_provider) { + $internaldata['userlistnoncompliance'] = true; + } } } diff --git a/admin/tool/dataprivacy/lang/en/tool_dataprivacy.php b/admin/tool/dataprivacy/lang/en/tool_dataprivacy.php index e9b8127792fbd..04772590a1c4c 100644 --- a/admin/tool/dataprivacy/lang/en/tool_dataprivacy.php +++ b/admin/tool/dataprivacy/lang/en/tool_dataprivacy.php @@ -293,6 +293,8 @@ $string['subjectscope_help'] = 'The subject scope lists the roles which may be assigned in this context.'; $string['summary'] = 'Registry configuration summary'; $string['user'] = 'User'; +$string['userlistnoncompliant'] = 'Userlist provider missing'; +$string['userlistexplanation'] = 'This plugin has the base provider but should also implement the userlist provider for full support of privacy functionality.'; $string['viewrequest'] = 'View the request'; $string['visible'] = 'Expand all'; $string['unexpiredrolewithretention'] = '{$a->retention} (Unexpired)'; diff --git a/admin/tool/dataprivacy/templates/component_status.mustache b/admin/tool/dataprivacy/templates/component_status.mustache index 3f7b6918119c2..e55a30b4085f5 100644 --- a/admin/tool/dataprivacy/templates/component_status.mustache +++ b/admin/tool/dataprivacy/templates/component_status.mustache @@ -64,6 +64,9 @@ {{#deprecated}} {{#str}}deprecated, tool_dataprivacy{{/str}} {{/deprecated}} + {{#userlistnoncompliance}} + {{#str}}userlistnoncompliant, tool_dataprivacy{{/str}} + {{/userlistnoncompliance}} {{#compliant}} diff --git a/admin/tool/dataprivacy/templates/data_registry_compliance.mustache b/admin/tool/dataprivacy/templates/data_registry_compliance.mustache index c4a9c1bc91932..bbca4ffe22d93 100644 --- a/admin/tool/dataprivacy/templates/data_registry_compliance.mustache +++ b/admin/tool/dataprivacy/templates/data_registry_compliance.mustache @@ -47,6 +47,8 @@
{{#str}}externalexplanation, tool_dataprivacy{{/str}}
{{#str}}deprecated, tool_dataprivacy{{/str}}
{{#str}}deprecatedexplanation, tool_dataprivacy{{/str}}
+
{{#str}}userlistnoncompliant, tool_dataprivacy{{/str}}
+
{{#str}}userlistexplanation, tool_dataprivacy{{/str}}

{{#str}}visible, tool_dataprivacy{{/str}}