diff --git a/admin/tool/log/classes/local/privacy/helper.php b/admin/tool/log/classes/local/privacy/helper.php index 4aa17d15ef2..8a057cf2a6f 100644 --- a/admin/tool/log/classes/local/privacy/helper.php +++ b/admin/tool/log/classes/local/privacy/helper.php @@ -99,8 +99,8 @@ class helper { 'name' => $name, 'description' => $description, 'timecreated' => transform::datetime($record->timecreated), - 'ip' => $record->ip, 'origin' => static::transform_origin($record->origin), + 'ip' => $isauthor ? $record->ip : '', 'other' => $other ? $other : [] ]; diff --git a/admin/tool/log/classes/privacy/provider.php b/admin/tool/log/classes/privacy/provider.php index af91b8b3215..252ba509e2f 100644 --- a/admin/tool/log/classes/privacy/provider.php +++ b/admin/tool/log/classes/privacy/provider.php @@ -74,7 +74,9 @@ class provider implements * @param approved_contextlist $contextlist The approved contexts to export information for. */ public static function export_user_data(approved_contextlist $contextlist) { - static::call_subplugins_method_with_args('export_user_data', [$contextlist]); + if (get_config('tool_log', 'exportlog')) { + static::call_subplugins_method_with_args('export_user_data', [$contextlist]); + } } /** diff --git a/admin/tool/log/lang/en/tool_log.php b/admin/tool/log/lang/en/tool_log.php index bfda3002e44..571b91fdd8f 100644 --- a/admin/tool/log/lang/en/tool_log.php +++ b/admin/tool/log/lang/en/tool_log.php @@ -24,6 +24,8 @@ $string['actlogshdr'] = 'Available log stores'; $string['configlogplugins'] = 'Please enable all required plugins and arrange them in appropriate order.'; +$string['exportlog'] = 'Include logs when exporting.'; +$string['exportlogdetail'] = 'Include logs that relate to the user when exporting.'; $string['logging'] = 'Logging'; $string['managelogging'] = 'Manage log stores'; $string['pluginname'] = 'Log store manager'; diff --git a/admin/tool/log/settings.php b/admin/tool/log/settings.php index 3fee81208dc..cbc3f31dcde 100644 --- a/admin/tool/log/settings.php +++ b/admin/tool/log/settings.php @@ -25,6 +25,16 @@ defined('MOODLE_INTERNAL') || die(); if ($hassiteconfig) { + + $privacysettings = $ADMIN->locate('privacysettings'); + + if ($ADMIN->fulltree) { + $privacysettings->add(new admin_setting_configcheckbox('tool_log/exportlog', + new lang_string('exportlog', 'tool_log'), + new lang_string('exportlogdetail', 'tool_log'), 1) + ); + } + $ADMIN->add('modules', new admin_category('logging', new lang_string('logging', 'tool_log'))); $temp = new admin_settingpage('managelogging', new lang_string('managelogging', 'tool_log')); diff --git a/admin/tool/log/version.php b/admin/tool/log/version.php index 041c70ead04..cb10fa6c06e 100644 --- a/admin/tool/log/version.php +++ b/admin/tool/log/version.php @@ -24,6 +24,6 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2017111300; // The current plugin version (Date: YYYYMMDDXX). +$plugin->version = 2017111301; // The current plugin version (Date: YYYYMMDDXX). $plugin->requires = 2017110800; // Requires this Moodle version. $plugin->component = 'tool_log'; // Full name of the plugin (used for diagnostics).