Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
|
The core_privacy\manager class, providing a facade to describe, export and delete personal data across Moodle and its components. More...
Public Member Functions | |
component_is_compliant (string $component) | |
Checks whether the given component is compliant with the core_privacy API. | |
delete_data_for_all_users_in_context (\context $context) | |
Delete all use data which matches the specified deletion criteria. | |
delete_data_for_user (contextlist_collection $contextlistcollection) | |
Delete all user data for approved contexts lists provided in the collection. | |
delete_data_for_users_in_context (\core_privacy\local\request\userlist_collection $collection) | |
Delete all user data for all specified users in a context. | |
export_user_data (contextlist_collection $contextlistcollection) | |
Export all user data for the specified approved_contextlist items. | |
get_contexts_for_userid (int $userid) | |
Gets a collection of resultset objects for all components. | |
get_metadata_for_components () | |
Get the privacy metadata for all components. | |
get_null_provider_reason (string $component) | |
Retrieve the reason for implementing the null provider interface. | |
get_users_in_context (\context $context) | |
Gets a collection of users for all components in the specified context. | |
set_observer (manager_observer $observer) | |
Set the failure handler. | |
Static Public Member Functions | |
static | component_class_callback (string $component, string $interface, string $methodname, array $params) |
Call the named method with the specified params on the supplied component if it implements the relevant interface on its provider. | |
static | get_provider_classname_for_component (string $component) |
Return the fully qualified provider classname for the component. | |
static | is_empty_subsystem ($component) |
Return whether this is an 'empty' subsystem - that is, a subsystem without a directory. | |
static | plugintype_class_callback (string $plugintype, string $interface, string $methodname, array $params) |
Call the named method with the specified params on any plugintype implementing the relevant interface. | |
Protected Member Functions | |
component_class_callback_failed (\Throwable $e, string $component, string $interface, string $methodname, array $params) | |
Notifies the observer of any failure. | |
component_implements (string $component, string $interface) | |
Checks whether the component's provider class implements the specified interface. | |
get_component_list () | |
Returns a list of frankenstyle names of core components (plugins and subsystems). | |
get_provider_classname ($component) | |
Return the fully qualified provider classname for the component. | |
handled_component_class_callback (string $component, string $interface, string $methodname, array $params) | |
Call the named method with the specified params on the supplied component if it implements the relevant interface on its provider. | |
Static Protected Member Functions | |
static | get_log_tracer () |
Get the tracer used for logging. | |
Protected Attributes | |
manager_observer | $observer |
Observer. | |
The core_privacy\manager class, providing a facade to describe, export and delete personal data across Moodle and its components.
This class is responsible for communicating with and collating privacy data from all relevant components, where relevance is determined through implementations of specific marker interfaces. These marker interfaces describe the responsibilities (in terms of personal data storage) as well as the relationship between the component and the core_privacy subsystem.
The interface hierarchy is as follows: ├── local\metadata\null_provider ├── local\metadata\provider ├── local\request\data_provider └── local\request\core_data_provider └── local\request\core_user_data_provider └── local\request\plugin\provider └── local\request\subsystem\provider └── local\request\user_preference_provider └── local\request\shared_data_provider └── local\request\plugin\subsystem_provider └── local\request\plugin\subplugin_provider └── local\request\subsystem\plugin_provider
All components must state whether they store personal data (and DESCRIBE it) by implementing one of the metadata providers:
The manager requests metadata for all Moodle components implementing the local\metadata\provider interface.
Those components storing personal data need to provide EXPORT and DELETION of this data by implementing a request provider. Which provider implementation depends on the nature of the component; whether it's a sub-component and which components it stores data for.
Export and deletion for sub-components (or any component storing data on behalf of another component) is managed by the parent component. If a component contains sub-components, it must ask those sub-components to provide the relevant data. Only certain 'core provider' components are called directly from the manager and these must provide the personal data stored by both themselves, and by all sub-components. Because of this hierarchical structure, the core_privacy\manager needs to know which components are to be called directly by core: these are called core data providers. The providers implemented by sub-components are called shared data providers.
The following are interfaces are not implemented directly, but are marker interfaces uses to classify components by nature:
The manager only requests the export or deletion of personal data for components implementing the local\request\core_data_provider interface or one of its descendants; local\request\plugin\provider, local\request\subsystem\provider or local\request\user_preference_provider. Implementing one of these signals to the core_privacy subsystem that the component must be queried directly from the manager.
Any component using another component to store personal data on its behalf, is responsible for making the relevant call to that component's relevant shared_data_provider class.
For example: The manager calls a core_data_provider component (e.g. mod_assign) which, in turn, calls relevant subplugins or subsystems (which assign uses to store personal data) to get that data. All data for assign and its sub-components is aggregated by assign and returned to the core_privacy subsystem.
|
static |
Call the named method with the specified params on the supplied component if it implements the relevant interface on its provider.
string | $component | The component to call |
string | $interface | The interface to implement |
string | $methodname | The method to call |
array | $params | The params to call |
mixed |
|
protected |
Notifies the observer of any failure.
Throwable | $e | |
string | $component | |
string | $interface | |
string | $methodname | |
array | $params |
|
protected |
Checks whether the component's provider class implements the specified interface.
This can either be implemented directly, or by implementing a descendant (extension) of the specified interface.
string | $component | the frankenstyle component name. |
string | $interface | the name of the interface we want to check. |
bool | True if an implementation was found, false otherwise. |
core_privacy\manager::component_is_compliant | ( | string | $component | ) |
Checks whether the given component is compliant with the core_privacy API.
To be considered compliant, a component must declare whether (and where) it stores personal data.
Components which do store personal data must:
Components which do not store personal data must:
string | $component | frankenstyle component name, e.g. 'mod_assign' |
bool | true if the component is compliant, false otherwise. |
core_privacy\manager::delete_data_for_all_users_in_context | ( | \context | $context | ) |
Delete all use data which matches the specified deletion criteria.
context | $context | The specific context to delete data for. |
core_privacy\manager::delete_data_for_user | ( | contextlist_collection | $contextlistcollection | ) |
Delete all user data for approved contexts lists provided in the collection.
This call relates to the forgetting of an entire user.
Note: userid and component are stored in each respective approved_contextlist.
contextlist_collection | $contextlistcollection | the collections of approved_contextlist items on which to call deletion. |
moodle_exception | if the contextlist_collection doesn't contain all approved_contextlist items, or if the component for an approved_contextlist isn't a core provider. |
core_privacy\manager::delete_data_for_users_in_context | ( | \core_privacy\local\request\userlist_collection | $collection | ) |
Delete all user data for all specified users in a context.
core_privacy\local\request\userlist_collection | $collection |
core_privacy\manager::export_user_data | ( | contextlist_collection | $contextlistcollection | ) |
Export all user data for the specified approved_contextlist items.
Note: userid and component are stored in each respective approved_contextlist.
contextlist_collection | $contextlistcollection | the collection of contextlists for all components. |
string | the location of the exported data. |
moodle_exception | if the contextlist_collection does not contain all approved_contextlist items or if one of the approved_contextlists' components is not a core_data_provider. |
|
protected |
Returns a list of frankenstyle names of core components (plugins and subsystems).
array | the array of frankenstyle component names. |
core_privacy\manager::get_contexts_for_userid | ( | int | $userid | ) |
Gets a collection of resultset objects for all components.
int | $userid | the id of the user we're fetching contexts for. |
contextlist_collection | the collection of contextlist items for the respective components. |
|
staticprotected |
Get the tracer used for logging.
The text tracer is used except for unit tests.
progress_trace |
core_privacy\manager::get_metadata_for_components | ( | ) |
Get the privacy metadata for all components.
collection[] | The array of collection objects, indexed by frankenstyle component name. |
core_privacy\manager::get_null_provider_reason | ( | string | $component | ) |
Retrieve the reason for implementing the null provider interface.
string | $component | Frankenstyle component name. |
string | The key to retrieve the language string for the null provider reason. |
|
protected |
Return the fully qualified provider classname for the component.
string | $component | the frankenstyle component name. |
string | the fully qualified provider classname. |
|
static |
Return the fully qualified provider classname for the component.
string | $component | the frankenstyle component name. |
string | the fully qualified provider classname. |
core_privacy\manager::get_users_in_context | ( | \context | $context | ) |
Gets a collection of users for all components in the specified context.
context | $context | The context to search |
userlist_collection | the collection of userlist items for the respective components. |
|
protected |
Call the named method with the specified params on the supplied component if it implements the relevant interface on its provider.
string | $component | The component to call |
string | $interface | The interface to implement |
string | $methodname | The method to call |
array | $params | The params to call |
mixed |
|
static |
Return whether this is an 'empty' subsystem - that is, a subsystem without a directory.
string | $component | Frankenstyle component name. |
string | The key to retrieve the language string for the null provider reason. |
|
static |
Call the named method with the specified params on any plugintype implementing the relevant interface.
string | $plugintype | The plugingtype to check |
string | $interface | The interface to implement |
string | $methodname | The method to call |
array | $params | The params to call |
core_privacy\manager::set_observer | ( | manager_observer | $observer | ) |
Set the failure handler.
manager_observer | $observer |