Merge branch 'MDL-61692-34-2' of https://github.com/snake/moodle into MOODLE_34_STABLE
This commit is contained in:
@@ -86,12 +86,28 @@ class collection {
|
||||
/**
|
||||
* Function to link a subsystem to the component.
|
||||
*
|
||||
* @param string $name the name of the subsystem to link.
|
||||
* @param string $summary A description of what is stored within this subsystem.
|
||||
* @param string $name the name of the subsystem to link.
|
||||
* @param array $privacyfields An optional associative array of fieldname to description.
|
||||
* @param string $summary A description of what is stored within this subsystem.
|
||||
* @return $this
|
||||
*/
|
||||
public function add_subsystem_link($name, array $privacyfields = [], $summary = '') {
|
||||
$this->add_type(new types\subsystem_link($name, $privacyfields, $summary));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Old function to link a subsystem to the component.
|
||||
*
|
||||
* This function is legacy and is not recommended. Please use add_subsystem_link() instead.
|
||||
*
|
||||
* @param string $name the name of the subsystem to link.
|
||||
* @param string $summary A description of what is stored within this subsystem.
|
||||
* @return $this
|
||||
*/
|
||||
public function link_subsystem($name, $summary = '') {
|
||||
$this->add_type(new types\subsystem_link($name, $summary));
|
||||
$this->add_type(new types\subsystem_link($name, [], $summary));
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -100,11 +116,27 @@ class collection {
|
||||
* Function to link a plugin to the component.
|
||||
*
|
||||
* @param string $name the name of the plugin to link.
|
||||
* @param string $summary A description of what tis stored within this plugin.
|
||||
* @param array $privacyfields An optional associative array of fieldname to description.
|
||||
* @param string $summary A description of what is stored within this plugin.
|
||||
* @return $this
|
||||
*/
|
||||
public function add_plugintype_link($name, array $privacyfields = [], $summary = '') {
|
||||
$this->add_type(new types\plugintype_link($name, $privacyfields, $summary));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Old function to link a plugin to the component.
|
||||
*
|
||||
* This function is legacy and is not recommended. Please use add_plugintype_link() instead.
|
||||
*
|
||||
* @param string $name the name of the plugin to link.
|
||||
* @param string $summary A description of what is stored within this plugin.
|
||||
* @return $this
|
||||
*/
|
||||
public function link_plugintype($name, $summary = '') {
|
||||
$this->add_type(new types\plugintype_link($name, $summary));
|
||||
$this->add_type(new types\plugintype_link($name, [], $summary));
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -118,6 +150,23 @@ class collection {
|
||||
* within the component.
|
||||
* @return $this
|
||||
*/
|
||||
public function add_external_location_link($name, array $privacyfields, $summary = '') {
|
||||
$this->add_type(new types\external_location($name, $privacyfields, $summary));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Old function to indicate that data may be exported to an external location.
|
||||
*
|
||||
* This function is legacy and is not recommended. Please use add_external_location_link() instead.
|
||||
*
|
||||
* @param string $name A name for the type of data exported.
|
||||
* @param array $privacyfields A list of fields with their description.
|
||||
* @param string $summary A description of what the table is used for. This is a language string identifier
|
||||
* within the component.
|
||||
* @return $this
|
||||
*/
|
||||
public function link_external_location($name, array $privacyfields, $summary = '') {
|
||||
$this->add_type(new types\external_location($name, $privacyfields, $summary));
|
||||
|
||||
|
||||
@@ -38,6 +38,11 @@ class plugintype_link implements type {
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* @var array The list of data names and descriptions.
|
||||
*/
|
||||
protected $privacyfields;
|
||||
|
||||
/**
|
||||
* @var string A description of what this plugintype is used to store.
|
||||
*/
|
||||
@@ -49,7 +54,7 @@ class plugintype_link implements type {
|
||||
* @param string $name The name of the plugintype to link.
|
||||
* @param string $summary A description of what is stored within this plugintype.
|
||||
*/
|
||||
public function __construct($name, $summary = '') {
|
||||
public function __construct($name, $privacyfields = [], $summary = '') {
|
||||
if (debugging('', DEBUG_DEVELOPER)) {
|
||||
$teststring = clean_param($summary, PARAM_STRINGID);
|
||||
if ($teststring !== $summary) {
|
||||
@@ -60,6 +65,7 @@ class plugintype_link implements type {
|
||||
}
|
||||
|
||||
$this->name = $name;
|
||||
$this->privacyfields = $privacyfields;
|
||||
$this->summary = $summary;
|
||||
}
|
||||
|
||||
@@ -78,7 +84,7 @@ class plugintype_link implements type {
|
||||
* @return array
|
||||
*/
|
||||
public function get_privacy_fields() : array {
|
||||
return [];
|
||||
return $this->privacyfields;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -38,6 +38,11 @@ class subsystem_link implements type {
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* @var array The list of data names and descriptions.
|
||||
*/
|
||||
protected $privacyfields;
|
||||
|
||||
/**
|
||||
* @var string A description of what this subsystem is used to store.
|
||||
*/
|
||||
@@ -47,9 +52,10 @@ class subsystem_link implements type {
|
||||
* Constructor for the subsystem_link.
|
||||
*
|
||||
* @param string $name The name of the subsystem to link.
|
||||
* @param array $privacyfields An optional array of fields and their descriptions.
|
||||
* @param string $summary A description of what is stored within this subsystem.
|
||||
*/
|
||||
public function __construct($name, $summary = '') {
|
||||
public function __construct($name, array $privacyfields = [], $summary = '') {
|
||||
if (debugging('', DEBUG_DEVELOPER)) {
|
||||
$teststring = clean_param($summary, PARAM_STRINGID);
|
||||
if ($teststring !== $summary) {
|
||||
@@ -60,6 +66,7 @@ class subsystem_link implements type {
|
||||
}
|
||||
|
||||
$this->name = $name;
|
||||
$this->privacyfields = $privacyfields;
|
||||
$this->summary = $summary;
|
||||
}
|
||||
|
||||
@@ -78,7 +85,7 @@ class subsystem_link implements type {
|
||||
* @return array
|
||||
*/
|
||||
public function get_privacy_fields() : array {
|
||||
return [];
|
||||
return $this->privacyfields;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -60,7 +60,7 @@ class core_privacy_metadata_collection extends advanced_testcase {
|
||||
public function test_add_type_known_type() {
|
||||
$collection = new collection('core_privacy');
|
||||
|
||||
$linked = new types\subsystem_link('example', 'langstring');
|
||||
$linked = new types\subsystem_link('example', [], 'langstring');
|
||||
$collection->add_type($linked);
|
||||
|
||||
$items = $collection->get_collection();
|
||||
@@ -74,10 +74,10 @@ class core_privacy_metadata_collection extends advanced_testcase {
|
||||
public function test_add_type_multiple() {
|
||||
$collection = new collection('core_privacy');
|
||||
|
||||
$a = new types\subsystem_link('example', 'langstring');
|
||||
$a = new types\subsystem_link('example', [], 'langstring');
|
||||
$collection->add_type($a);
|
||||
|
||||
$b = new types\subsystem_link('example', 'langstring');
|
||||
$b = new types\subsystem_link('example', [], 'langstring');
|
||||
$collection->add_type($b);
|
||||
|
||||
$items = $collection->get_collection();
|
||||
|
||||
@@ -44,8 +44,8 @@ class core_privacy_metadata_types_plugintype_link extends advanced_testcase {
|
||||
* @param string $name Name
|
||||
* @param string $summary Summary
|
||||
*/
|
||||
public function test_invalid_configs($name, $summary) {
|
||||
$record = new plugintype_link($name, $summary);
|
||||
public function test_invalid_configs($name, $privacyfields, $summary) {
|
||||
$record = new plugintype_link($name, $privacyfields, $summary);
|
||||
$this->assertDebuggingCalled();
|
||||
}
|
||||
|
||||
@@ -56,12 +56,12 @@ class core_privacy_metadata_types_plugintype_link extends advanced_testcase {
|
||||
* @param string $name Name
|
||||
* @param string $summary Summary
|
||||
*/
|
||||
public function test_invalid_configs_debug_normal($name, $summary) {
|
||||
public function test_invalid_configs_debug_normal($name, $privacyfields, $summary) {
|
||||
global $CFG;
|
||||
$this->resetAfterTest();
|
||||
|
||||
$CFG->debug = DEBUG_NORMAL;
|
||||
$record = new plugintype_link($name, $summary);
|
||||
$record = new plugintype_link($name, $privacyfields, $summary);
|
||||
$this->assertDebuggingNotCalled();
|
||||
}
|
||||
|
||||
@@ -72,8 +72,8 @@ class core_privacy_metadata_types_plugintype_link extends advanced_testcase {
|
||||
* @param string $name Name
|
||||
* @param string $summary Summary
|
||||
*/
|
||||
public function test_valid_configs($name, $summary) {
|
||||
$record = new plugintype_link($name, $summary);
|
||||
public function test_valid_configs($name, $privacyfields, $summary) {
|
||||
$record = new plugintype_link($name, $privacyfields, $summary);
|
||||
$this->assertDebuggingNotCalled();
|
||||
}
|
||||
|
||||
@@ -86,10 +86,12 @@ class core_privacy_metadata_types_plugintype_link extends advanced_testcase {
|
||||
return [
|
||||
'Space in summary' => [
|
||||
'example',
|
||||
[],
|
||||
'This table is used for purposes.',
|
||||
],
|
||||
'Comma in summary' => [
|
||||
'example',
|
||||
[],
|
||||
'privacy,foo',
|
||||
],
|
||||
];
|
||||
@@ -104,6 +106,7 @@ class core_privacy_metadata_types_plugintype_link extends advanced_testcase {
|
||||
return [
|
||||
'Valid combination' => [
|
||||
'example',
|
||||
[],
|
||||
'privacy:example:valid',
|
||||
],
|
||||
];
|
||||
|
||||
@@ -44,8 +44,8 @@ class core_privacy_metadata_types_subsystem_link extends advanced_testcase {
|
||||
* @param string $name Name
|
||||
* @param string $summary Summary
|
||||
*/
|
||||
public function test_invalid_configs($name, $summary) {
|
||||
$record = new subsystem_link($name, $summary);
|
||||
public function test_invalid_configs($name, $privacyfields, $summary) {
|
||||
$record = new subsystem_link($name, $privacyfields, $summary);
|
||||
$this->assertDebuggingCalled();
|
||||
}
|
||||
|
||||
@@ -56,12 +56,12 @@ class core_privacy_metadata_types_subsystem_link extends advanced_testcase {
|
||||
* @param string $name Name
|
||||
* @param string $summary Summary
|
||||
*/
|
||||
public function test_invalid_configs_debug_normal($name, $summary) {
|
||||
public function test_invalid_configs_debug_normal($name, $privacyfields, $summary) {
|
||||
global $CFG;
|
||||
$this->resetAfterTest();
|
||||
|
||||
$CFG->debug = DEBUG_NORMAL;
|
||||
$record = new subsystem_link($name, $summary);
|
||||
$record = new subsystem_link($name, $privacyfields, $summary);
|
||||
$this->assertDebuggingNotCalled();
|
||||
}
|
||||
|
||||
@@ -72,8 +72,8 @@ class core_privacy_metadata_types_subsystem_link extends advanced_testcase {
|
||||
* @param string $name Name
|
||||
* @param string $summary Summary
|
||||
*/
|
||||
public function test_valid_configs($name, $summary) {
|
||||
$record = new subsystem_link($name, $summary);
|
||||
public function test_valid_configs($name, $privacyfields, $summary) {
|
||||
$record = new subsystem_link($name, $privacyfields, $summary);
|
||||
$this->assertDebuggingNotCalled();
|
||||
}
|
||||
|
||||
@@ -86,10 +86,12 @@ class core_privacy_metadata_types_subsystem_link extends advanced_testcase {
|
||||
return [
|
||||
'Space in summary' => [
|
||||
'example',
|
||||
[],
|
||||
'This table is used for purposes.',
|
||||
],
|
||||
'Comma in summary' => [
|
||||
'example',
|
||||
[],
|
||||
'privacy,foo',
|
||||
],
|
||||
];
|
||||
@@ -104,6 +106,7 @@ class core_privacy_metadata_types_subsystem_link extends advanced_testcase {
|
||||
return [
|
||||
'Valid combination' => [
|
||||
'example',
|
||||
[],
|
||||
'privacy:example:valid',
|
||||
],
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user