MDL-62147 privacy: corrections to tables, temporary tables

This commit is contained in:
Marina Glancy 2018-05-16 11:03:38 +08:00
parent dc69734963
commit d1620c57f9
11 changed files with 147 additions and 10 deletions

View File

@ -51,7 +51,7 @@ class provider implements
* @return collection A listing of user data stored through this system.
*/
public static function get_metadata(collection $collection) : collection {
$collection->add_database_table('log', [
$collection->add_database_table('logstore_standard_log', [
'eventname' => 'privacy:metadata:log:eventname',
'userid' => 'privacy:metadata:log:userid',
'relateduserid' => 'privacy:metadata:log:relateduserid',

View File

@ -25,6 +25,10 @@
namespace block_recent_activity\privacy;
use core_privacy\local\metadata\collection;
use core_privacy\local\request\approved_contextlist;
use core_privacy\local\request\contextlist;
defined('MOODLE_INTERNAL') || die();
/**
@ -33,15 +37,61 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2018 Shamim Rezaie <shamim@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
class provider implements \core_privacy\local\metadata\provider,
\core_privacy\local\request\plugin\provider {
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
* Returns metadata.
*
* @return string
* @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_reason() : string {
return 'privacy:metadata';
public static function get_metadata(collection $collection) : collection {
// This plugin defines a db table but it is not considered personal data and, therefore, not exported or deleted.
$collection->add_database_table('block_recent_activity', [
'courseid' => 'privacy:metadata:block_recent_activity:courseid',
'cmid' => 'privacy:metadata:block_recent_activity:cmid',
'timecreated' => 'privacy:metadata:block_recent_activity:timecreated',
'userid' => 'privacy:metadata:block_recent_activity:userid',
'action' => 'privacy:metadata:block_recent_activity:action',
'modname' => 'privacy:metadata:block_recent_activity:modname'
], 'privacy:metadata:block_recent_activity');
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) {
}
/**
* 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) {
}
/**
* 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) {
}
}

View File

@ -25,6 +25,13 @@
$string['pluginname'] = 'Recent activity';
$string['privacy:metadata'] = 'The recent activity block contains a cache of data stored elsewhere in Moodle.';
$string['privacy:metadata:block_recent_activity'] = 'Temporary log of recent teacher activity. Removed after two days';
$string['privacy:metadata:block_recent_activity:action'] = 'Action: created, updated or deleted';
$string['privacy:metadata:block_recent_activity:cmid'] = 'Course module id';
$string['privacy:metadata:block_recent_activity:courseid'] = 'Course id';
$string['privacy:metadata:block_recent_activity:modname'] = 'Module type name (for delete action)';
$string['privacy:metadata:block_recent_activity:timecreated'] = 'Time when action was performed';
$string['privacy:metadata:block_recent_activity:userid'] = 'User performing the action';
$string['recent_activity:addinstance'] = 'Add a new recent activity block';
$string['recent_activity:viewaddupdatemodule'] = 'View added and updated modules in recent activity block';
$string['recent_activity:viewdeletemodule'] = 'View deleted modules in recent activity block';

View File

@ -1563,6 +1563,16 @@ $string['privacy:metadata:events_queue:eventdata'] = 'The data stored in the eve
$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:log'] = 'A collection of past events';
$string['privacy:metadata:log:action'] = 'A description of the action';
$string['privacy:metadata:log:cmid'] = 'cmid';
$string['privacy:metadata:log:course'] = 'course';
$string['privacy:metadata:log:info'] = 'Additional information';
$string['privacy:metadata:log:ip'] = 'The IP address used at the time of the event';
$string['privacy:metadata:log:module'] = 'module';
$string['privacy:metadata:log:time'] = 'The date at wich the action took place';
$string['privacy:metadata:log:url'] = 'The URL related to the event';
$string['privacy:metadata:log:userid'] = 'The ID of the user who performed the action';
$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.';

View File

@ -75,6 +75,10 @@ $string['privacy:metadata:middlename'] = 'The middle name of the user.';
$string['privacy:metadata:mnethostid'] = 'An identifier for the mnet host if used.';
$string['privacy:metadata:model'] = 'The device name, occam or iPhone etc..';
$string['privacy:metadata:msn'] = 'The MSN identifier of the user.';
$string['privacy:metadata:my_pages'] = 'User pages - dashboard and profile. This table does not contain personal data and only used to link dashboard blocks to users';
$string['privacy:metadata:my_pages:name'] = 'Page name';
$string['privacy:metadata:my_pages:private'] = 'Whether or not the page is private (dashboard) or public (profile)';
$string['privacy:metadata:my_pages:userid'] = 'The user who owns this page or 0 for system defaults';
$string['privacy:metadata:password'] = 'The password for this user to log into the system.';
$string['privacy:metadata:passwordresettablesummary'] = 'A table tracking password reset confirmation tokens';
$string['privacy:metadata:passwordtablesummary'] = 'A rotating log of hashes of previously used passwords for the user.';
@ -87,6 +91,10 @@ $string['privacy:metadata:reason'] = 'The reason for requesting this course.';
$string['privacy:metadata:requester'] = 'An identifier to a user that requested this course.';
$string['privacy:metadata:requestsummary'] = 'Stores information about requests for courses that users make.';
$string['privacy:metadata:suspended'] = 'A flag to show if the user has been suspended on this system.';
$string['privacy:metadata:user_preferences'] = 'Preferences associated with the given user';
$string['privacy:metadata:user_preferences:name'] = 'Preference name';
$string['privacy:metadata:user_preferences:userid'] = 'User id';
$string['privacy:metadata:user_preferences:value'] = 'Preference value';
$string['privacy:metadata:username'] = 'The username for this user.';
$string['privacy:metadata:secret'] = 'Secret.. not sure.';
$string['privacy:metadata:sessdata'] = 'Session content';

View File

@ -91,6 +91,16 @@ class provider implements \core_privacy\local\metadata\provider, \core_privacy\l
'timecreated' => 'privacy:metadata:events_queue:timecreated',
], 'privacy:metadata:events_queue');
// The log table is defined in core but used in logstore_legacy.
$collection->add_database_table('log', [
'time' => 'privacy:metadata:log:time',
'userid' => 'privacy:metadata:log:userid',
'ip' => 'privacy:metadata:log:ip',
'action' => 'privacy:metadata:log:action',
'url' => 'privacy:metadata:log:url',
'info' => 'privacy:metadata:log:info'
], 'privacy:metadata:log');
return $collection;
}

View File

@ -65,10 +65,26 @@ class provider implements
'timestamp' => 'privacy:metadata:messages:timestamp',
], 'privacy:metadata:messages');
// The tables chat_messages_current and chat_users are not reported here
// The tables chat_messages_current and chat_users are not exported/deleted
// because they are considered as short-lived data and are deleted on a
// regular basis by cron, or during normal requests. MDL-62006 was raised
// to discuss and/or implement support for those tables.
// regular basis by cron, or during normal requests. TODO MDL-62006.
$collection->add_database_table('chat_messages_current', [
'userid' => 'privacy:metadata:messages:userid',
'message' => 'privacy:metadata:messages:message',
'issystem' => 'privacy:metadata:messages:issystem',
'timestamp' => 'privacy:metadata:messages:timestamp'
], 'privacy:metadata:chat_messages_current');
$collection->add_database_table('chat_users', [
'userid' => 'privacy:metadata:chat_users:userid',
'version' => 'privacy:metadata:chat_users:version',
'ip' => 'privacy:metadata:chat_users:ip',
'firstping' => 'privacy:metadata:chat_users:firstping',
'lastping' => 'privacy:metadata:chat_users:lastping',
'lastmessageping' => 'privacy:metadata:chat_users:lastmessageping',
'lang' => 'privacy:metadata:chat_users:lang'
], 'privacy:metadata:chat_users');
return $collection;
}

View File

@ -118,6 +118,15 @@ $string['page-mod-chat-x'] = 'Any chat module page';
$string['pastchats'] = 'Past chat sessions';
$string['pluginadministration'] = 'Chat administration';
$string['pluginname'] = 'Chat';
$string['privacy:metadata:chat_messages_current'] = 'Current chat session. This data is temporary and is deleted after the chat session is deleted';
$string['privacy:metadata:chat_users'] = 'Keeps track of which users are in which chat rooms';
$string['privacy:metadata:chat_users:firstping'] = 'Time of the first access to chat room';
$string['privacy:metadata:chat_users:ip'] = 'User IP';
$string['privacy:metadata:chat_users:lang'] = 'User language';
$string['privacy:metadata:chat_users:lastmessageping'] = 'Time of the last message in this chat room';
$string['privacy:metadata:chat_users:lastping'] = 'Time of the last access to chat room';
$string['privacy:metadata:chat_users:userid'] = 'User id';
$string['privacy:metadata:chat_users:version'] = 'How user accessed the chat (sockets/basic/ajax/header_js)';
$string['privacy:metadata:messages'] = 'A record of the messages sent during a chat session';
$string['privacy:metadata:messages:issystem'] = 'Whether the message is a system-generated message';
$string['privacy:metadata:messages:message'] = 'The message';

View File

@ -117,6 +117,14 @@ class provider implements
'forumid' => 'privacy:metadata:forum_track_prefs:forumid',
], 'privacy:metadata:forum_track_prefs');
// The 'forum_queue' table stores temporary data that is not exported/deleted.
$items->add_database_table('forum_queue', [
'userid' => 'privacy:metadata:forum_queue:userid',
'discussionid' => 'privacy:metadata:forum_queue:discussionid',
'postid' => 'privacy:metadata:forum_queue:postid',
'timemodified' => 'privacy:metadata:forum_queue:timemodified'
], 'privacy:metadata:forum_queue');
// Forum posts can be tagged and rated.
$items->link_subsystem('core_tag', 'privacy:metadata:core_tag');
$items->link_subsystem('core_rating', 'privacy:metadata:core_rating');

View File

@ -457,6 +457,11 @@ $string['privacy:metadata:forum_posts:parent'] = 'The parent post that was repli
$string['privacy:metadata:forum_posts:subject'] = 'The subject of the forum post.';
$string['privacy:metadata:forum_posts:totalscore'] = 'The message of the forum post.';
$string['privacy:metadata:forum_posts:userid'] = 'The ID of the user who authored the forum post.';
$string['privacy:metadata:forum_queue'] = 'Temporary log of posts that will be mailed in digest form';
$string['privacy:metadata:forum_queue:discussionid'] = 'Forum discussion id';
$string['privacy:metadata:forum_queue:postid'] = 'Forum post id';
$string['privacy:metadata:forum_queue:timemodified'] = 'The modified time of the original post';
$string['privacy:metadata:forum_queue:userid'] = 'User who needs to be notified of the post';
$string['privacy:metadata:forum_read'] = 'Information about which posts have been read by the user.';
$string['privacy:metadata:forum_read:discussionid'] = 'The discussion that the post is in.';
$string['privacy:metadata:forum_read:firstread'] = 'The first time that the post was read.';

View File

@ -154,6 +154,18 @@ class provider implements \core_privacy\local\metadata\provider, \core_privacy\l
'requester' => 'privacy:metadata:requester'
];
$mypages = [
'userid' => 'privacy:metadata:my_pages:userid',
'name' => 'privacy:metadata:my_pages:name',
'private' => 'privacy:metadata:my_pages:private',
];
$userpreferences = [
'userid' => 'privacy:metadata:user_preferences:userid',
'name' => 'privacy:metadata:user_preferences:name',
'value' => 'privacy:metadata:user_preferences:value'
];
$collection->add_database_table('user', $userfields, 'privacy:metadata:usertablesummary');
$collection->add_database_table('user_password_history', $passwordhistory, 'privacy:metadata:passwordtablesummary');
$collection->add_database_table('user_password_resets', $userpasswordresets, 'privacy:metadata:passwordresettablesummary');
@ -161,6 +173,8 @@ class provider implements \core_privacy\local\metadata\provider, \core_privacy\l
$collection->add_database_table('user_devices', $userdevices, 'privacy:metadata:devicetablesummary');
$collection->add_database_table('course_request', $courserequest, 'privacy:metadata:requestsummary');
$collection->add_database_table('sessions', $usersessions, 'privacy:metadata:sessiontablesummary');
$collection->add_database_table('my_pages', $mypages, 'privacy:metadata:my_pages');
$collection->add_database_table('user_preferences', $userpreferences, 'privacy:metadata:user_preferences');
$collection->add_subsystem_link('core_files', [], 'privacy:metadata:filelink');
return $collection;