Skip to content

Commit

Permalink
MDL-63566 tool_dataprivacy: New interface check for userlist.
Browse files Browse the repository at this point in the history
This adds another check to see if the plugins are implementing the
new core_userlist_provider.
  • Loading branch information
abgreeve authored and mickhawkins committed Nov 1, 2018
1 parent 4b68132 commit 63ca758
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
9 changes: 8 additions & 1 deletion admin/tool/dataprivacy/classes/metadata_registry.php
Expand Up @@ -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;
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions admin/tool/dataprivacy/lang/en/tool_dataprivacy.php
Expand Up @@ -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)';
Expand Down
3 changes: 3 additions & 0 deletions admin/tool/dataprivacy/templates/component_status.mustache
Expand Up @@ -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}}
Expand Down
Expand Up @@ -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>
Expand Down

0 comments on commit 63ca758

Please sign in to comment.