Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Privacy Subsystem implementation for core_message.

Copyright: 2018 Mark Nelson <markn@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 1058 lines (49 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: provider  - X-Ref

Privacy Subsystem implementation for core_message.

get_metadata(collection $items)   X-Ref
Return the fields which contain personal data.

param: collection $items a reference to the collection to use to store the metadata.
return: collection the updated collection of metadata items.

export_user_preferences(int $userid)   X-Ref
Store all user preferences for core message.

param: int $userid The userid of the user whose data is to be exported.

get_contexts_for_userid(int $userid)   X-Ref
Get the list of contexts that contain user information for the specified user.

param: int $userid the userid.
return: contextlist the list of contexts containing user info for the user.

get_users_in_context(userlist $userlist)   X-Ref
Get the list of users who have data within a context.

param: userlist    $userlist   The userlist containing the list of users who have data in this context/plugin combination.

export_user_data(approved_contextlist $contextlist)   X-Ref
Export personal data for the given approved_contextlist. User and context information is contained within the contextlist.

param: approved_contextlist $contextlist a list of contexts approved for export.

delete_data_for_all_users_in_context(\context $context)   X-Ref
Delete all data for all users in the specified context.

param: \context $context the context to delete in.

delete_data_for_user(approved_contextlist $contextlist)   X-Ref
Delete all user data for the specified user, in the specified contexts.

param: approved_contextlist $contextlist a list of contexts approved for deletion.

delete_data_for_users(approved_userlist $userlist)   X-Ref
Delete multiple users within a single context.

param: approved_userlist       $userlist The approved context and user information to delete information for.

add_contexts_for_conversations(contextlist $contextlist, int $userid, string $component,string $itemtype, int $itemid = 0)   X-Ref
Provide a list of contexts which have conversations for the user, in the respective area (component/itemtype combination).

This method is to be called by consumers of the messaging subsystem (plugins), in their get_contexts_for_userid() method,
to add the contexts for items which may have any conversation, but would normally not be reported as having user data by the
plugin responsible for them.

param: contextlist $contextlist
param: int $userid The id of the user in scope.
param: string $component the frankenstyle component name.
param: string $itemtype the type of the conversation items.
param: int $itemid Optional itemid associated with component.

add_conversations_in_context(userlist $userlist, string $component, string $itemtype, int $itemid = 0)   X-Ref
Add the list of users who have a conversation in the specified area (component + itemtype + itemid).

param: userlist $userlist The userlist to add the users to.
param: string $component The component to check.
param: string $itemtype The type of the conversation items.
param: int $itemid Optional itemid associated with component.

export_conversations(int $userid, string $component, string $itemtype, \context $context,array $subcontext = [], int $itemid = 0)   X-Ref
Store all conversations which match the specified component, itemtype, and itemid.

Conversations without context (for now, the private ones) are stored in '<$context> | Messages | <Other user id>'.
Conversations with context are stored in '<$context> | Messages | <Conversation item type> | <Conversation name>'.

param: int         $userid The user whose information is to be exported.
param: string      $component The component to fetch data from.
param: string      $itemtype The itemtype that the data was exported in within the component.
param: \context    $context The context to export for.
param: array       $subcontext The sub-context in which to export this data.
param: int         $itemid Optional itemid associated with component.

delete_conversations_for_all_users(\context $context, string $component, string $itemtype,int $itemid = 0)   X-Ref
Deletes all group memberships for a specified context and component.

param: \context  $context    Details about which context to delete group memberships for.
param: string    $component  The component to delete. Empty string means no component.
param: string    $itemtype   The itemtype of the component to delele. Empty string means no itemtype.
param: int       $itemid     Optional itemid associated with component.

delete_conversations_for_user(approved_contextlist $contextlist, string $component, string $itemtype,int $itemid = 0)   X-Ref
Deletes all records for a user from a list of approved contexts.

When the component and the itemtype are empty and there is only one user context in the list, all the
conversations without contextid will be removed. However, if the component and itemtype are defined,
only the conversations in these area for the contexts in $contextlist wil be deleted.

param: approved_contextlist  $contextlist    Contains the user ID and a list of contexts to be deleted from.
param: string    $component  The component to delete. Empty string means no component.
param: string    $itemtype   The itemtype of the component to delele. Empty string means no itemtype.
param: int       $itemid     Optional itemid associated with component.

delete_conversations_for_users(approved_userlist $userlist, string $component, string $itemtype,int $itemid = 0)   X-Ref
Deletes all records for multiple users within a single context.

param: approved_userlist $userlist  The approved context and user information to delete information for.
param: string    $component  The component to delete. Empty string means no component.
param: string    $itemtype   The itemtype of the component to delele. Empty string means no itemtype.
param: int       $itemid     Optional itemid associated with component.

delete_user_data_conversations(int $userid, array $contextids, string $component,string $itemtype, int $itemid = 0)   X-Ref
Deletes all records for multiple users within multiple contexts in a component area.

param: int    $userid     The user identifier to delete information for.
param: array  $contextids The context identifiers to delete information for. Empty array means no context (for
param: string $component  The component to delete. Empty string means no component (for individual conversations).
param: string $itemtype   The itemtype of the component to delele. Empty string means no itemtype (for individual
param: int    $itemid     Optional itemid associated with component.

delete_user_data(int $userid)   X-Ref
Delete all user data for the specified user.

param: int $userid The user id

export_user_data_contacts(int $userid)   X-Ref
Export the messaging contact data.

param: int $userid

export_user_data_contact_requests(int $userid)   X-Ref
Export the messaging contact requests data.

param: int $userid

export_user_data_blocked_users(int $userid)   X-Ref
Export the messaging blocked users data.

param: int $userid

export_user_data_conversation_messages(int $userid, \stdClass $conversation, \context $context,array $subcontext = [])   X-Ref
Export conversation messages.

param: int $userid The user identifier.
param: \stdClass $conversation The conversation to export the messages.
param: \context $context The context to export for.
param: array $subcontext The sub-context in which to export this data.

export_user_data_notifications(int $userid)   X-Ref
Export the notification data.

param: int $userid