mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 07:56:06 +02:00
Merge branch 'MDL-62425-master' of git://github.com/andrewnicols/moodle
This commit is contained in:
commit
05dcf35796
@ -122,11 +122,15 @@ class metadata_registry {
|
||||
* @return array An array of plugin types which contain plugin data.
|
||||
*/
|
||||
protected function get_full_component_list() {
|
||||
global $CFG;
|
||||
|
||||
$list = \core_component::get_component_list();
|
||||
$list['core']['core'] = "{$CFG->dirroot}/lib";
|
||||
$formattedlist = [];
|
||||
foreach ($list as $plugintype => $plugin) {
|
||||
$formattedlist[] = ['plugin_type' => $plugintype, 'plugins' => array_keys($plugin)];
|
||||
}
|
||||
|
||||
return $formattedlist;
|
||||
}
|
||||
|
||||
|
@ -72,8 +72,9 @@ class tool_dataprivacy_metadata_registry_testcase extends advanced_testcase {
|
||||
}
|
||||
|
||||
// Let's check core subsystems.
|
||||
// The Privacy API adds an extra component in the form of 'core'.
|
||||
$coresubsystems = \core_component::get_core_subsystems();
|
||||
$this->assertEquals(count($coresubsystems), count($data['core']));
|
||||
$this->assertEquals(count($coresubsystems) + 1, count($data['core']));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1551,6 +1551,32 @@ $string['previous'] = 'Previous';
|
||||
$string['previouslyselectedusers'] = 'Previously selected users not matching \'{$a}\'';
|
||||
$string['previoussection'] = 'Previous section';
|
||||
$string['primaryadminsetup'] = 'Setup administrator account';
|
||||
$string['privacy:metadata:config_log'] = 'The log of configuration changes.';
|
||||
$string['privacy:metadata:config_log:name'] = 'The name of the setting changes.';
|
||||
$string['privacy:metadata:config_log:oldvalue'] = 'The previous value for this setting.';
|
||||
$string['privacy:metadata:config_log:plugin'] = 'The plugin modified.';
|
||||
$string['privacy:metadata:config_log:timemodified'] = 'The time that the change was made.';
|
||||
$string['privacy:metadata:config_log:userid'] = 'The user who made the change.';
|
||||
$string['privacy:metadata:config_log:value'] = 'The new value for this setting.';
|
||||
$string['privacy:metadata:events_queue'] = 'The queue of user events waiting to be processed.';
|
||||
$string['privacy:metadata:events_queue:eventdata'] = 'The data stored in the event.';
|
||||
$string['privacy:metadata:events_queue:stackdump'] = 'Any stacktrace associated with this event.';
|
||||
$string['privacy:metadata:events_queue:timecreated'] = 'The time that this event was created.';
|
||||
$string['privacy:metadata:events_queue:userid'] = 'The userid associated with this event.';
|
||||
$string['privacy:metadata:task_adhoc'] = 'The status of adhoc tasks.';
|
||||
$string['privacy:metadata:task_adhoc:component'] = 'The component owning the task.';
|
||||
$string['privacy:metadata:task_adhoc:nextruntime'] = 'The earliest time to run this task.';
|
||||
$string['privacy:metadata:task_adhoc:userid'] = 'The user to run the task as.';
|
||||
$string['privacy:metadata:upgrade_log'] = 'The upgrade log.';
|
||||
$string['privacy:metadata:upgrade_log:backtrace'] = 'Any backtrace associated with this upgrade step.';
|
||||
$string['privacy:metadata:upgrade_log:details'] = 'Extra information relating to the upgrade.';
|
||||
$string['privacy:metadata:upgrade_log:info'] = 'The main information for this upgrade step.';
|
||||
$string['privacy:metadata:upgrade_log:plugin'] = 'The plugin which was upgraded.';
|
||||
$string['privacy:metadata:upgrade_log:targetversion'] = 'The new version to upgrade to.';
|
||||
$string['privacy:metadata:upgrade_log:timemodified'] = 'The time that the upgrade took place.';
|
||||
$string['privacy:metadata:upgrade_log:type'] = 'The type of log entry.';
|
||||
$string['privacy:metadata:upgrade_log:userid'] = 'The user who ran the upgrade.';
|
||||
$string['privacy:metadata:upgrade_log:version'] = 'The old version of the plugin.';
|
||||
$string['privatefiles'] = 'Private files';
|
||||
$string['privatefilesmanage'] = 'Manage private files';
|
||||
$string['private_files_handler'] = 'Store attachments to an e-mail in the user\'s private files storage space.';
|
||||
|
135
lib/classes/privacy/provider.php
Normal file
135
lib/classes/privacy/provider.php
Normal file
@ -0,0 +1,135 @@
|
||||
<?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 core
|
||||
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace core\privacy;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
use \core_privacy\local\metadata\collection;
|
||||
use \core_privacy\local\request\contextlist;
|
||||
use \core_privacy\local\request\approved_contextlist;
|
||||
|
||||
/**
|
||||
* Privacy class for requesting user data.
|
||||
*
|
||||
* @package core
|
||||
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class provider implements \core_privacy\local\metadata\provider, \core_privacy\local\request\subsystem\provider {
|
||||
|
||||
/**
|
||||
* Returns information about the user data stored in this component.
|
||||
*
|
||||
* @param collection $collection A list of information about this component
|
||||
* @return collection The collection object filled out with information about this component.
|
||||
*/
|
||||
public static function get_metadata(collection $collection) : collection {
|
||||
// These tables are really data about site configuration and not user data.
|
||||
|
||||
// The config_log includes information about which user performed a configuration change.
|
||||
// The value and oldvalue may contain sensitive information such as accounts for service passwords..
|
||||
// This is not considered to be user data.
|
||||
$collection->add_database_table('config_log', [
|
||||
'userid' => 'privacy:metadata:config_log:userid',
|
||||
'timemodified' => 'privacy:metadata:config_log:timemodified',
|
||||
'plugin' => 'privacy:metadata:config_log:plugin',
|
||||
'name' => 'privacy:metadata:config_log:name',
|
||||
'value' => 'privacy:metadata:config_log:value',
|
||||
'oldvalue' => 'privacy:metadata:config_log:oldvalue',
|
||||
], 'privacy:metadata:config_log');
|
||||
|
||||
// The upgrade_log includes information about which user performed an upgrade.
|
||||
// This is not considered to be user data.
|
||||
$collection->add_database_table('upgrade_log', [
|
||||
'type' => 'privacy:metadata:upgrade_log:type',
|
||||
'plugin' => 'privacy:metadata:upgrade_log:plugin',
|
||||
'version' => 'privacy:metadata:upgrade_log:version',
|
||||
'targetversion' => 'privacy:metadata:upgrade_log:targetversion',
|
||||
'info' => 'privacy:metadata:upgrade_log:info',
|
||||
'details' => 'privacy:metadata:upgrade_log:details',
|
||||
'backtrace' => 'privacy:metadata:upgrade_log:backtrace',
|
||||
'userid' => 'privacy:metadata:upgrade_log:userid',
|
||||
'timemodified' => 'privacy:metadata:upgrade_log:timemodified',
|
||||
], 'privacy:metadata:upgrade_log');
|
||||
|
||||
// The task_adhoc includes information about pending adhoc tasks, some of which may be run as a user.
|
||||
// These are removed as the task completes.
|
||||
$collection->add_database_table('task_adhoc', [
|
||||
'component' => 'privacy:metadata:task_adhoc:component',
|
||||
'nextruntime' => 'privacy:metadata:task_adhoc:nextruntime',
|
||||
'userid' => 'privacy:metadata:task_adhoc:userid',
|
||||
], 'privacy:metadata:task_adhoc');
|
||||
|
||||
// The events_queue includes information about pending events tasks.
|
||||
// These are stored for short periods whilst being processed into other locations.
|
||||
$collection->add_database_table('events_queue', [
|
||||
'eventdata' => 'privacy:metadata:events_queue:eventdata',
|
||||
'stackdump' => 'privacy:metadata:events_queue:stackdump',
|
||||
'userid' => 'privacy:metadata:events_queue:userid',
|
||||
'timecreated' => 'privacy:metadata:events_queue:timecreated',
|
||||
], 'privacy:metadata:events_queue');
|
||||
|
||||
return $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of contexts that contain user information for the specified user.
|
||||
*
|
||||
* @param int $userid The user to search.
|
||||
* @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin.
|
||||
*/
|
||||
public static function get_contexts_for_userid(int $userid) : contextlist {
|
||||
return new contextlist();
|
||||
}
|
||||
|
||||
/**
|
||||
* Export all user data for the specified user, in the specified contexts.
|
||||
*
|
||||
* @param approved_contextlist $contextlist The approved contexts to export information for.
|
||||
*/
|
||||
public static function export_user_data(approved_contextlist $contextlist) {
|
||||
// None of the core tables should be exported.
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all data for all users in the specified context.
|
||||
*
|
||||
* @param context $context The specific context to delete data for.
|
||||
*/
|
||||
public static function delete_data_for_all_users_in_context(\context $context) {
|
||||
// None of the the data from these tables should be deleted.
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all user data for the specified user, in the specified contexts.
|
||||
*
|
||||
* @param approved_contextlist $contextlist The approved contexts and user information to delete information for.
|
||||
*/
|
||||
public static function delete_data_for_user(approved_contextlist $contextlist) {
|
||||
// None of the the data from these tables should be deleted.
|
||||
// Note: Although it may be tempting to delete the adhoc task data, do not do so.
|
||||
// The delete process is run as an adhoc task.
|
||||
}
|
||||
}
|
@ -385,9 +385,12 @@ class manager {
|
||||
* @return array the array of frankenstyle component names.
|
||||
*/
|
||||
protected function get_component_list() {
|
||||
return array_keys(array_reduce(\core_component::get_component_list(), function($carry, $item) {
|
||||
$components = array_keys(array_reduce(\core_component::get_component_list(), function($carry, $item) {
|
||||
return array_merge($carry, $item);
|
||||
}, []));
|
||||
$components[] = 'core';
|
||||
|
||||
return $components;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user