/**
* 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;
}
* 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;
}
* 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));
*/
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.
*/
* @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) {
}
$this->name = $name;
+ $this->privacyfields = $privacyfields;
$this->summary = $summary;
}
* @return array
*/
public function get_privacy_fields() : array {
- return null;
+ return $this->privacyfields;
}
/**
*/
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.
*/
* 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) {
}
$this->name = $name;
+ $this->privacyfields = $privacyfields;
$this->summary = $summary;
}
* @return array
*/
public function get_privacy_fields() : array {
- return null;
+ return $this->privacyfields;
}
/**
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();
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();
* @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();
}
* @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();
}
* @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();
}
return [
'Space in summary' => [
'example',
+ [],
'This table is used for purposes.',
],
'Comma in summary' => [
'example',
+ [],
'privacy,foo',
],
];
return [
'Valid combination' => [
'example',
+ [],
'privacy:example:valid',
],
];
* @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();
}
* @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();
}
* @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();
}
return [
'Space in summary' => [
'example',
+ [],
'This table is used for purposes.',
],
'Comma in summary' => [
'example',
+ [],
'privacy,foo',
],
];
return [
'Valid combination' => [
'example',
+ [],
'privacy:example:valid',
],
];