MDL-63566 tool_dataprivacy: New interface check for userlist.
authorAdrian Greeve <abgreeve@gmail.com>
Wed, 24 Oct 2018 06:33:44 +0000 (14:33 +0800)
committerMichael Hawkins <michaelh@moodle.com>
Thu, 1 Nov 2018 02:06:45 +0000 (10:06 +0800)
This adds another check to see if the plugins are implementing the
new core_userlist_provider.

admin/tool/dataprivacy/classes/metadata_registry.php
admin/tool/dataprivacy/lang/en/tool_dataprivacy.php
admin/tool/dataprivacy/templates/component_status.mustache
admin/tool/dataprivacy/templates/data_registry_compliance.mustache

index 96c9e55..3d25904 100644 (file)
@@ -77,14 +77,21 @@ class metadata_registry {
                     $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;
+                        }
                     }
                 }
 
index 0c5ac5f..77be3d2 100644 (file)
@@ -293,6 +293,8 @@ $string['subjectscope'] = 'Subject scope';
 $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)';
index 3f7b691..e55a30b 100644 (file)
@@ -64,6 +64,9 @@
         {{#deprecated}}
             <span class="badge badge-pill badge-warning">{{#str}}deprecated, tool_dataprivacy{{/str}}</span>
         {{/deprecated}}
+        {{#userlistnoncompliance}}
+            <span class="badge badge-pill badge-warning">{{#str}}userlistnoncompliant, tool_dataprivacy{{/str}}</span>
+        {{/userlistnoncompliance}}
     </div>
 
     {{#compliant}}
index c4a9c1b..bbca4ff 100644 (file)
@@ -47,6 +47,8 @@
         <dd>{{#str}}externalexplanation, tool_dataprivacy{{/str}}</dd>
         <dt><span class="badge badge-pill badge-warning">{{#str}}deprecated, tool_dataprivacy{{/str}}</span></dt>
         <dd>{{#str}}deprecatedexplanation, tool_dataprivacy{{/str}}</dd>
+        <dt><span class="badge badge-pill badge-warning">{{#str}}userlistnoncompliant, tool_dataprivacy{{/str}}</span></dt>
+        <dd>{{#str}}userlistexplanation, tool_dataprivacy{{/str}}</dd>
     </dl>
     <hr />
     <div class="clearfix"><a class="tool_dataprivacy-expand-all pull-right" href="#" data-visibility-state='visible'>{{#str}}visible, tool_dataprivacy{{/str}}</a></div>