diff --git a/lang/en/search.php b/lang/en/search.php index ebd0f5a32e7..685aa2a360c 100644 --- a/lang/en/search.php +++ b/lang/en/search.php @@ -76,6 +76,7 @@ $string['notitle'] = 'No title'; $string['normalsearch'] = 'Normal search'; $string['openedon'] = 'opened on'; $string['optimize'] = 'Optimize'; +$string['privacy:metadata'] = 'The search subsystem does not store any personal data.'; $string['queryerror'] = 'The query you provided could not be parsed by the search engine: {$a}'; $string['resultsreturnedfor'] = 'results returned for'; $string['runindexer'] = 'Run indexer (real)'; diff --git a/search/classes/privacy/provider.php b/search/classes/privacy/provider.php new file mode 100644 index 00000000000..eb0c7ed4a59 --- /dev/null +++ b/search/classes/privacy/provider.php @@ -0,0 +1,46 @@ +. + +/** + * Privacy Subsystem implementation for core_search. + * + * @package core_search + * @copyright 2018 David Monllao + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace core_search\privacy; + +defined('MOODLE_INTERNAL') || die(); + +/** + * Privacy Subsystem for core_search implementing null_provider. + * + * @copyright 2018 David Monllao + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class provider implements \core_privacy\local\metadata\null_provider { + + /** + * Get the language string identifier with the component's language + * file to explain why this plugin stores no data. + * + * @return string + */ + public static function get_reason() { + return 'privacy:metadata'; + } +} diff --git a/search/engine/solr/classes/privacy/provider.php b/search/engine/solr/classes/privacy/provider.php new file mode 100644 index 00000000000..568f362d25d --- /dev/null +++ b/search/engine/solr/classes/privacy/provider.php @@ -0,0 +1,51 @@ +. + +/** + * Privacy class for requesting user data. + * + * @package search_solr + * @copyright 2018 David Monllao + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +namespace search_solr\privacy; + +defined('MOODLE_INTERNAL') || die(); + +use core_privacy\local\metadata\collection; + +/** + * Provider for the search_solr plugin. + * + * @copyright 2018 David Monllao + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class provider implements + // This search engine plugin does not store any data itself. + // It has no database tables, and it purely acts as a conduit, sending data externally. + \core_privacy\local\metadata\provider { + + /** + * Returns meta data about this system. + * + * @param collection $collection The initialised collection to add items to. + * @return collection A listing of user data stored through this system. + */ + public static function get_metadata(collection $collection) { + return $collection->add_external_location_link('solr', ['data' => 'privacy:metadata:data'], + 'privacy:metadata'); + } +} diff --git a/search/engine/solr/lang/en/search_solr.php b/search/engine/solr/lang/en/search_solr.php index 6addfea4c24..78bc2c27567 100644 --- a/search/engine/solr/lang/en/search_solr.php +++ b/search/engine/solr/lang/en/search_solr.php @@ -38,6 +38,8 @@ $string['missingconfig'] = 'Your Apache Solr server is not yet configured in Moo $string['multivaluedfield'] = 'Field "{$a}" returned an array instead of a scalar. Please delete the current index, create a new one and run setup_schema.php before indexing data in Solr.'; $string['nodatafromserver'] = 'No data from server'; $string['pluginname'] = 'Solr'; +$string['privacy:metadata'] = 'This plugin sends data externally to a linked Solr search engine. It does not store data locally.'; +$string['privacy:metadata:data'] = 'Personal data passed through from the search subsystem.'; $string['schemafieldautocreated'] = 'Field "{$a}" already exists in Solr schema. You probably forgot to run this script before indexing data and fields were autocreated by Solr. Please delete the current index, create a new one and run setup_schema.php again before indexing data in Solr.'; $string['schemasetupfromsolr5'] = 'Your Solr server version is lower than 5.0. This script can only set your schema if your Solr version is 5.0 or higher. You need to manually set the fields in your schema according to \\search_solr\\document::get_default_fields_definition().'; $string['searchinfo'] = 'Search queries'; diff --git a/search/engine/solr/tests/privacy_test.php b/search/engine/solr/tests/privacy_test.php new file mode 100644 index 00000000000..ad90b575e5b --- /dev/null +++ b/search/engine/solr/tests/privacy_test.php @@ -0,0 +1,46 @@ +. + +/** + * Privacy provider tests. + * + * @package search_solr + * @copyright 2018 David Monllao + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +/** + * Privacy provider tests class. + * + * @copyright 2018 David Monllao + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class search_solr_privacy_test extends \core_privacy\tests\provider_testcase { + + /** + * Verify that a collection of metadata is returned for this component and that it just links to an external location. + */ + public function test_get_metadata() { + $collection = new \core_privacy\local\metadata\collection('search_solr'); + $collection = \search_solr\privacy\provider::get_metadata($collection); + $this->assertNotEmpty($collection); + $items = $collection->get_collection(); + $this->assertEquals(1, count($items)); + $this->assertInstanceOf(\core_privacy\local\metadata\types\external_location::class, $items[0]); + } +} diff --git a/search/tests/fixtures/mock_search_area.php b/search/tests/fixtures/mock_search_area.php index bdc38670586..4d815e29ab2 100644 --- a/search/tests/fixtures/mock_search_area.php +++ b/search/tests/fixtures/mock_search_area.php @@ -74,7 +74,7 @@ class mock_search_area extends \core_search\base { $doc->set('title', $info->title); $doc->set('content', $info->content); $doc->set('description1', $info->description1); - $doc->set('description1', $info->description2); + $doc->set('description2', $info->description2); $doc->set('contextid', $info->contextid); $doc->set('courseid', $info->courseid); $doc->set('userid', $info->userid);