Moodle PHP Documentation 4.1
Moodle 4.1.11 (Build: 20240610) (c8c84b4af18)
tool_dataprivacy\external Class Reference

Class external. More...

Inheritance diagram for tool_dataprivacy\external:
external_api

Static Public Member Functions

static approve_data_request ($requestid)
 Approve a data request.
 
static approve_data_request_parameters ()
 Parameter description for approve_data_request().
 
static approve_data_request_returns ()
 Parameter description for approve_data_request().
 
static bulk_approve_data_requests ($requestids)
 Bulk approve bulk data request.
 
static bulk_approve_data_requests_parameters ()
 Parameter description for bulk_approve_data_requests().
 
static bulk_approve_data_requests_returns ()
 Parameter description for bulk_approve_data_requests().
 
static bulk_deny_data_requests ($requestids)
 Bulk deny data requests.
 
static bulk_deny_data_requests_parameters ()
 Parameter description for bulk_deny_data_requests().
 
static bulk_deny_data_requests_returns ()
 Parameter description for bulk_deny_data_requests().
 
static call_external_function ($function, $args, $ajaxonly=false)
 Call an external function validating all params/returns correctly.
 
static cancel_data_request ($requestid)
 Cancel a data request.
 
static cancel_data_request_parameters ()
 Parameter description for cancel_data_request().
 
static cancel_data_request_returns ()
 Parameter description for cancel_data_request().
 
static clean_returnvalue (external_description $description, $response)
 Clean response If a response attribute is unknown from the description, we just ignore the attribute.
 
static confirm_contexts_for_deletion ($ids)
 Confirm a given array of expired context record IDs.
 
static confirm_contexts_for_deletion_parameters ()
 Parameters for confirm_contexts_for_deletion().
 
static confirm_contexts_for_deletion_returns ()
 Returns for confirm_contexts_for_deletion().
 
static contact_dpo ($message)
 Make a general enquiry to a DPO.
 
static contact_dpo_parameters ()
 Parameter description for contact_dpo().
 
static contact_dpo_returns ()
 Parameter description for contact_dpo().
 
static create_category_form ($jsonformdata)
 Creates a data category from form data.
 
static create_category_form_parameters ()
 Parameter description for create_category_form().
 
static create_category_form_returns ()
 Returns for create_category_form().
 
static create_purpose_form ($jsonformdata)
 Creates a data purpose from form data.
 
static create_purpose_form_parameters ()
 Parameter description for create_purpose_form().
 
static create_purpose_form_returns ()
 Returns for create_purpose_form().
 
static delete_category ($id)
 Deletes a data category.
 
static delete_category_parameters ()
 Parameter description for delete_category().
 
static delete_category_returns ()
 Parameter description for delete_category().
 
static delete_purpose ($id)
 Deletes a data purpose.
 
static delete_purpose_parameters ()
 Parameter description for delete_purpose().
 
static delete_purpose_returns ()
 Parameter description for delete_purpose().
 
static deny_data_request ($requestid)
 Deny a data request.
 
static deny_data_request_parameters ()
 Parameter description for deny_data_request().
 
static deny_data_request_returns ()
 Parameter description for deny_data_request().
 
static external_function_info ($function, $strictness=MUST_EXIST)
 Returns detailed function information.
 
static get_activity_options ($nodefaults)
 Fetches a list of activity options for setting data registry defaults.
 
static get_activity_options_parameters ()
 Parameters for get_activity_options().
 
static get_activity_options_returns ()
 Returns for get_category_options().
 
static get_category_options ($includeinherit, $includenotset)
 Fetches a list of data category options containing category IDs as keys and the category name for the value.
 
static get_category_options_parameters ()
 Parameters for get_category_options().
 
static get_category_options_returns ()
 Returns for get_category_options().
 
static get_data_request ($requestid)
 Fetch the details of a user's data request.
 
static get_data_request_parameters ()
 Parameter description for get_data_request().
 
static get_data_request_returns ()
 Parameter description for get_data_request().
 
static get_purpose_options ($includeinherit, $includenotset)
 Fetches a list of data storage purposes containing purpose IDs as keys and the purpose name for the value.
 
static get_purpose_options_parameters ()
 Parameters for get_purpose_options().
 
static get_purpose_options_returns ()
 Returns for get_purpose_options().
 
static get_users ($query)
 Fetch the details of a user's data request.
 
static get_users_parameters ()
 Parameter description for get_data_request().
 
static get_users_returns ()
 Parameter description for get_users().
 
static mark_complete ($requestid)
 Mark a user's general enquiry's status as complete.
 
static mark_complete_parameters ()
 Parameter description for mark_complete().
 
static mark_complete_returns ()
 Parameter description for mark_complete().
 
static set_context_defaults ($contextlevel, $category, $purpose, $activity, $override)
 Updates the default category and purpose for a given context level (and optionally, a plugin).
 
static set_context_defaults_parameters ()
 Parameters for set_context_defaults().
 
static set_context_defaults_returns ()
 Returns for set_context_defaults().
 
static set_context_form ($jsonformdata)
 Creates a data category from form data.
 
static set_context_form_parameters ()
 Parameter description for set_context_form().
 
static set_context_form_returns ()
 Returns for set_context_form().
 
static set_context_restriction ($context)
 Set context restriction for all following subsequent function calls.
 
static set_contextlevel_form ($jsonformdata)
 Creates a data category from form data.
 
static set_contextlevel_form_parameters ()
 Parameter description for set_contextlevel_form().
 
static set_contextlevel_form_returns ()
 Returns for set_contextlevel_form().
 
static set_timeout ($seconds=360)
 This method has to be called before every operation that takes a longer time to finish!
 
static tree_extra_branches ($contextid, $element)
 Returns tree extra branches.
 
static tree_extra_branches_parameters ()
 Parameter description for tree_extra_branches().
 
static tree_extra_branches_returns ()
 Returns for tree_extra_branches().
 
static validate_context ($context)
 Makes sure user may execute functions in this context.
 
static validate_parameters (external_description $description, $params)
 Validates submitted function parameters, if anything is incorrect invalid_parameter_exception is thrown.
 

Static Protected Member Functions

static get_context_from_params ($param)
 Get context from passed parameters.
 
static get_context_parameters ()
 Returns a prepared structure to use a context parameters.
 

Detailed Description

Class external.

The external API for the Data Privacy tool.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ approve_data_request()

static tool_dataprivacy\external::approve_data_request ( $requestid)
static

Approve a data request.

Since
Moodle 3.5
Parameters
int$requestidThe request ID.
Return values
array
Exceptions
coding_exception
dml_exception
invalid_parameter_exception
restricted_context_exception
moodle_exception

◆ approve_data_request_parameters()

static tool_dataprivacy\external::approve_data_request_parameters ( )
static

Parameter description for approve_data_request().

Since
Moodle 3.5
Return values
external_function_parameters

◆ approve_data_request_returns()

static tool_dataprivacy\external::approve_data_request_returns ( )
static

Parameter description for approve_data_request().

Since
Moodle 3.5
Return values
external_description

◆ bulk_approve_data_requests()

static tool_dataprivacy\external::bulk_approve_data_requests ( $requestids)
static

Bulk approve bulk data request.

Since
Moodle 3.5
Parameters
array$requestidsArray consisting the request ID's.
Return values
array
Exceptions
coding_exception
dml_exception
invalid_parameter_exception
restricted_context_exception
moodle_exception

◆ bulk_approve_data_requests_parameters()

static tool_dataprivacy\external::bulk_approve_data_requests_parameters ( )
static

Parameter description for bulk_approve_data_requests().

Since
Moodle 3.5
Return values
external_function_parameters

◆ bulk_approve_data_requests_returns()

static tool_dataprivacy\external::bulk_approve_data_requests_returns ( )
static

Parameter description for bulk_approve_data_requests().

Since
Moodle 3.5
Return values
external_description

◆ bulk_deny_data_requests()

static tool_dataprivacy\external::bulk_deny_data_requests ( $requestids)
static

Bulk deny data requests.

Since
Moodle 3.5
Parameters
array$requestidsArray consisting of request ID's.
Return values
array
Exceptions
coding_exception
dml_exception
invalid_parameter_exception
restricted_context_exception
moodle_exception

◆ bulk_deny_data_requests_parameters()

static tool_dataprivacy\external::bulk_deny_data_requests_parameters ( )
static

Parameter description for bulk_deny_data_requests().

Since
Moodle 3.5
Return values
external_function_parameters

◆ bulk_deny_data_requests_returns()

static tool_dataprivacy\external::bulk_deny_data_requests_returns ( )
static

Parameter description for bulk_deny_data_requests().

Since
Moodle 3.5
Return values
external_description

◆ call_external_function()

static external_api::call_external_function ( $function,
$args,
$ajaxonly = false )
staticinherited

Call an external function validating all params/returns correctly.

Note that an external function may modify the state of the current page, so this wrapper saves and restores tha PAGE and COURSE global variables before/after calling the external function.

Parameters
string$functionA webservice function name.
array$argsParams array (named params)
boolean$ajaxonlyIf true, an extra check will be peformed to see if ajax is required.
Return values
arraycontaining keys for error (bool), exception and data.

◆ cancel_data_request()

static tool_dataprivacy\external::cancel_data_request ( $requestid)
static

Cancel a data request.

Since
Moodle 3.5
Parameters
int$requestidThe request ID.
Return values
array
Exceptions
invalid_persistent_exception
coding_exception
invalid_parameter_exception
restricted_context_exception

◆ cancel_data_request_parameters()

static tool_dataprivacy\external::cancel_data_request_parameters ( )
static

Parameter description for cancel_data_request().

Since
Moodle 3.5
Return values
external_function_parameters

◆ cancel_data_request_returns()

static tool_dataprivacy\external::cancel_data_request_returns ( )
static

Parameter description for cancel_data_request().

Since
Moodle 3.5
Return values
external_description

◆ clean_returnvalue()

static external_api::clean_returnvalue ( external_description $description,
$response )
staticinherited

Clean response If a response attribute is unknown from the description, we just ignore the attribute.

If a response attribute is incorrect, invalid_response_exception is thrown. Note: this function is similar to validate parameters, however it is distinct because parameters validation must be distinct from cleaning return values.

Parameters
external_description$descriptiondescription of the return values
mixed$responsethe actual response
Return values
mixedresponse with added defaults for optional items, invalid_response_exception thrown if any problem found
Author
2010 Jerome Mouneyrac
Since
Moodle 2.0

◆ confirm_contexts_for_deletion()

static tool_dataprivacy\external::confirm_contexts_for_deletion ( $ids)
static

Confirm a given array of expired context record IDs.

Since
Moodle 3.5
Parameters
int[]$idsArray of record IDs from the expired contexts table.
Return values
array
Exceptions
coding_exception
dml_exception
invalid_parameter_exception
restricted_context_exception

◆ confirm_contexts_for_deletion_parameters()

static tool_dataprivacy\external::confirm_contexts_for_deletion_parameters ( )
static

Parameters for confirm_contexts_for_deletion().

Since
Moodle 3.5
Return values
external_function_parameters

◆ confirm_contexts_for_deletion_returns()

static tool_dataprivacy\external::confirm_contexts_for_deletion_returns ( )
static

Returns for confirm_contexts_for_deletion().

Since
Moodle 3.5
Return values
external_single_structure

◆ contact_dpo()

static tool_dataprivacy\external::contact_dpo ( $message)
static

Make a general enquiry to a DPO.

Since
Moodle 3.5
Parameters
string$messageThe message to be sent to the DPO.
Return values
array
Exceptions
coding_exception
invalid_parameter_exception
invalid_persistent_exception
restricted_context_exception
dml_exception
moodle_exception

◆ contact_dpo_parameters()

static tool_dataprivacy\external::contact_dpo_parameters ( )
static

Parameter description for contact_dpo().

Since
Moodle 3.5
Return values
external_function_parameters

◆ contact_dpo_returns()

static tool_dataprivacy\external::contact_dpo_returns ( )
static

Parameter description for contact_dpo().

Since
Moodle 3.5
Return values
external_description

◆ create_category_form()

static tool_dataprivacy\external::create_category_form ( $jsonformdata)
static

Creates a data category from form data.

Since
Moodle 3.5
Parameters
string$jsonformdata
Return values
array

◆ create_category_form_parameters()

static tool_dataprivacy\external::create_category_form_parameters ( )
static

Parameter description for create_category_form().

Since
Moodle 3.5
Return values
external_function_parameters

◆ create_category_form_returns()

static tool_dataprivacy\external::create_category_form_returns ( )
static

Returns for create_category_form().

Since
Moodle 3.5
Return values
external_single_structure

◆ create_purpose_form()

static tool_dataprivacy\external::create_purpose_form ( $jsonformdata)
static

Creates a data purpose from form data.

Since
Moodle 3.5
Parameters
string$jsonformdata
Return values
array

◆ create_purpose_form_parameters()

static tool_dataprivacy\external::create_purpose_form_parameters ( )
static

Parameter description for create_purpose_form().

Since
Moodle 3.5
Return values
external_function_parameters

◆ create_purpose_form_returns()

static tool_dataprivacy\external::create_purpose_form_returns ( )
static

Returns for create_purpose_form().

Since
Moodle 3.5
Return values
external_single_structure

◆ delete_category()

static tool_dataprivacy\external::delete_category ( $id)
static

Deletes a data category.

Since
Moodle 3.5
Parameters
int$idThe ID.
Return values
array
Exceptions
invalid_persistent_exception
coding_exception
invalid_parameter_exception

◆ delete_category_parameters()

static tool_dataprivacy\external::delete_category_parameters ( )
static

Parameter description for delete_category().

Since
Moodle 3.5
Return values
external_function_parameters

◆ delete_category_returns()

static tool_dataprivacy\external::delete_category_returns ( )
static

Parameter description for delete_category().

Since
Moodle 3.5
Return values
external_single_structure

◆ delete_purpose()

static tool_dataprivacy\external::delete_purpose ( $id)
static

Deletes a data purpose.

Since
Moodle 3.5
Parameters
int$idThe ID.
Return values
array
Exceptions
invalid_persistent_exception
coding_exception
invalid_parameter_exception

◆ delete_purpose_parameters()

static tool_dataprivacy\external::delete_purpose_parameters ( )
static

Parameter description for delete_purpose().

Since
Moodle 3.5
Return values
external_function_parameters

◆ delete_purpose_returns()

static tool_dataprivacy\external::delete_purpose_returns ( )
static

Parameter description for delete_purpose().

Since
Moodle 3.5
Return values
external_single_structure

◆ deny_data_request()

static tool_dataprivacy\external::deny_data_request ( $requestid)
static

Deny a data request.

Since
Moodle 3.5
Parameters
int$requestidThe request ID.
Return values
array
Exceptions
coding_exception
dml_exception
invalid_parameter_exception
restricted_context_exception
moodle_exception

◆ deny_data_request_parameters()

static tool_dataprivacy\external::deny_data_request_parameters ( )
static

Parameter description for deny_data_request().

Since
Moodle 3.5
Return values
external_function_parameters

◆ deny_data_request_returns()

static tool_dataprivacy\external::deny_data_request_returns ( )
static

Parameter description for deny_data_request().

Since
Moodle 3.5
Return values
external_description

◆ external_function_info()

static external_api::external_function_info ( $function,
$strictness = MUST_EXIST )
staticinherited

Returns detailed function information.

Parameters
string | object$functionname of external function or record from external_function
int$strictnessIGNORE_MISSING means compatible mode, false returned if record not found, debug message if more found; MUST_EXIST means throw exception if no record or multiple records found
Return values
stdClassdescription or false if not found or exception thrown
Exceptions
coding_exceptionfor any property and/or method that is missing or invalid
Since
Moodle 2.0

◆ get_activity_options()

static tool_dataprivacy\external::get_activity_options ( $nodefaults)
static

Fetches a list of activity options for setting data registry defaults.

Parameters
boolean$nodefaultsIf false, it will fetch all of the activities. Otherwise, it will only fetch the activities that don't have defaults yet (e.g. when adding a new activity module defaults).
Return values
array

◆ get_activity_options_parameters()

static tool_dataprivacy\external::get_activity_options_parameters ( )
static

Parameters for get_activity_options().

Return values
external_function_parameters

◆ get_activity_options_returns()

static tool_dataprivacy\external::get_activity_options_returns ( )
static

Returns for get_category_options().

Return values
external_single_structure

◆ get_category_options()

static tool_dataprivacy\external::get_category_options ( $includeinherit,
$includenotset )
static

Fetches a list of data category options containing category IDs as keys and the category name for the value.

Parameters
bool$includeinheritWhether to include the "Inherit" option.
bool$includenotsetWhether to include the "Not set" option.
Return values
array

◆ get_category_options_parameters()

static tool_dataprivacy\external::get_category_options_parameters ( )
static

Parameters for get_category_options().

Return values
external_function_parameters

◆ get_category_options_returns()

static tool_dataprivacy\external::get_category_options_returns ( )
static

Returns for get_category_options().

Return values
external_single_structure

◆ get_context_from_params()

static external_api::get_context_from_params ( $param)
staticprotectedinherited

Get context from passed parameters.

The passed array must either contain a contextid or a combination of context level and instance id to fetch the context. For example, the context level can be "course" and instanceid can be courseid.

See context_helper\get_all_levels() for a list of valid context levels.

Parameters
array$param
Since
Moodle 2.6
Exceptions
invalid_parameter_exception
Return values
context

◆ get_context_parameters()

static external_api::get_context_parameters ( )
staticprotectedinherited

Returns a prepared structure to use a context parameters.

Return values
external_single_structure

Reimplemented in core_competency\external, and tool_lp\external.

◆ get_data_request()

static tool_dataprivacy\external::get_data_request ( $requestid)
static

Fetch the details of a user's data request.

Since
Moodle 3.5
Parameters
int$requestidThe request ID.
Return values
array
Exceptions
coding_exception
dml_exception
invalid_parameter_exception
restricted_context_exception
moodle_exception

◆ get_data_request_parameters()

static tool_dataprivacy\external::get_data_request_parameters ( )
static

Parameter description for get_data_request().

Since
Moodle 3.5
Return values
external_function_parameters

◆ get_data_request_returns()

static tool_dataprivacy\external::get_data_request_returns ( )
static

Parameter description for get_data_request().

Since
Moodle 3.5
Return values
external_description

◆ get_purpose_options()

static tool_dataprivacy\external::get_purpose_options ( $includeinherit,
$includenotset )
static

Fetches a list of data storage purposes containing purpose IDs as keys and the purpose name for the value.

Parameters
bool$includeinheritWhether to include the "Inherit" option.
bool$includenotsetWhether to include the "Not set" option.
Return values
array

◆ get_purpose_options_parameters()

static tool_dataprivacy\external::get_purpose_options_parameters ( )
static

Parameters for get_purpose_options().

Return values
external_function_parameters

◆ get_purpose_options_returns()

static tool_dataprivacy\external::get_purpose_options_returns ( )
static

Returns for get_purpose_options().

Return values
external_single_structure

◆ get_users()

static tool_dataprivacy\external::get_users ( $query)
static

Fetch the details of a user's data request.

Since
Moodle 3.5
Parameters
string$queryThe search request.
Return values
array
Exceptions
required_capability_exception
dml_exception
invalid_parameter_exception
restricted_context_exception

◆ get_users_parameters()

static tool_dataprivacy\external::get_users_parameters ( )
static

Parameter description for get_data_request().

Since
Moodle 3.5
Return values
external_function_parameters

◆ get_users_returns()

static tool_dataprivacy\external::get_users_returns ( )
static

Parameter description for get_users().

Since
Moodle 3.5
Return values
external_description
Exceptions
coding_exception

◆ mark_complete()

static tool_dataprivacy\external::mark_complete ( $requestid)
static

Mark a user's general enquiry's status as complete.

Since
Moodle 3.5.2
Parameters
int$requestidThe request ID of the general enquiry.
Return values
array
Exceptions
coding_exception
invalid_parameter_exception
invalid_persistent_exception
restricted_context_exception
dml_exception
moodle_exception

◆ mark_complete_parameters()

static tool_dataprivacy\external::mark_complete_parameters ( )
static

Parameter description for mark_complete().

Since
Moodle 3.5.2
Return values
external_function_parameters

◆ mark_complete_returns()

static tool_dataprivacy\external::mark_complete_returns ( )
static

Parameter description for mark_complete().

Since
Moodle 3.5.2
Return values
external_description

◆ set_context_defaults()

static tool_dataprivacy\external::set_context_defaults ( $contextlevel,
$category,
$purpose,
$activity,
$override )
static

Updates the default category and purpose for a given context level (and optionally, a plugin).

Parameters
int$contextlevelThe context level.
int$categoryThe ID matching the category.
int$purposeThe ID matching the purpose record.
int$activityThe name of the activity that we're making a defaults configuration for.
bool$overrideWhether to override the purpose/categories of existing instances to these defaults.
Return values
array

◆ set_context_defaults_parameters()

static tool_dataprivacy\external::set_context_defaults_parameters ( )
static

Parameters for set_context_defaults().

Return values
external_function_parameters

◆ set_context_defaults_returns()

static tool_dataprivacy\external::set_context_defaults_returns ( )
static

Returns for set_context_defaults().

Return values
external_single_structure

◆ set_context_form()

static tool_dataprivacy\external::set_context_form ( $jsonformdata)
static

Creates a data category from form data.

Since
Moodle 3.5
Parameters
string$jsonformdata
Return values
array

◆ set_context_form_parameters()

static tool_dataprivacy\external::set_context_form_parameters ( )
static

Parameter description for set_context_form().

Since
Moodle 3.5
Return values
external_function_parameters

◆ set_context_form_returns()

static tool_dataprivacy\external::set_context_form_returns ( )
static

Returns for set_context_form().

Since
Moodle 3.5
Return values
external_single_structure

◆ set_context_restriction()

static external_api::set_context_restriction ( $context)
staticinherited

Set context restriction for all following subsequent function calls.

Parameters
stdClass$contextthe context restriction
Since
Moodle 2.0

◆ set_contextlevel_form()

static tool_dataprivacy\external::set_contextlevel_form ( $jsonformdata)
static

Creates a data category from form data.

Since
Moodle 3.5
Parameters
string$jsonformdata
Return values
array

◆ set_contextlevel_form_parameters()

static tool_dataprivacy\external::set_contextlevel_form_parameters ( )
static

Parameter description for set_contextlevel_form().

Since
Moodle 3.5
Return values
external_function_parameters

◆ set_contextlevel_form_returns()

static tool_dataprivacy\external::set_contextlevel_form_returns ( )
static

Returns for set_contextlevel_form().

Since
Moodle 3.5
Return values
external_single_structure

◆ set_timeout()

static external_api::set_timeout ( $seconds = 360)
staticinherited

This method has to be called before every operation that takes a longer time to finish!

Parameters
int$secondsmax expected time the next operation needs
Since
Moodle 2.0

◆ tree_extra_branches()

static tool_dataprivacy\external::tree_extra_branches ( $contextid,
$element )
static

Returns tree extra branches.

Since
Moodle 3.5
Parameters
int$contextid
string$element
Return values
array

◆ tree_extra_branches_parameters()

static tool_dataprivacy\external::tree_extra_branches_parameters ( )
static

Parameter description for tree_extra_branches().

Since
Moodle 3.5
Return values
external_function_parameters

◆ tree_extra_branches_returns()

static tool_dataprivacy\external::tree_extra_branches_returns ( )
static

Returns for tree_extra_branches().

Since
Moodle 3.5
Return values
external_single_structure

◆ validate_context()

static external_api::validate_context ( $context)
staticinherited

Makes sure user may execute functions in this context.

Parameters
stdClass$context
Since
Moodle 2.0

◆ validate_parameters()

static external_api::validate_parameters ( external_description $description,
$params )
staticinherited

Validates submitted function parameters, if anything is incorrect invalid_parameter_exception is thrown.

This is a simple recursive method which is intended to be called from each implementation method of external API.

Parameters
external_description$descriptiondescription of parameters
mixed$paramsthe actual parameters
Return values
mixedparams with added defaults for optional items, invalid_parameters_exception thrown if any problem found
Since
Moodle 2.0

The documentation for this class was generated from the following file: