MDL-62217 search: Privacy providers
This commit is contained in:
@@ -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)';
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* 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';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* 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');
|
||||
}
|
||||
}
|
||||
@@ -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';
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* 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]);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user