MDL-61889 tool_dataprivacy: Fix CI errors

This commit is contained in:
Jun Pataleta 2018-05-17 17:00:03 +08:00
parent 6153be6850
commit dd26f1be12
23 changed files with 109 additions and 83 deletions

View file

@ -197,7 +197,7 @@ class api {
} else {
// If not a DPO, only users with the capability to make data requests for the user should be allowed.
// (e.g. users with the Parent role, etc).
if (!api::can_create_data_request_for_user($foruser)) {
if (!self::can_create_data_request_for_user($foruser)) {
$forusercontext = \context_user::instance($foruser);
throw new required_capability_exception($forusercontext,
'tool/dataprivacy:makedatarequestsforchildren', 'nopermissions', '');

View file

@ -289,7 +289,8 @@ class data_registry {
* @param int $forcedcategoryvalue Use this value as if this was this context level category.
* @return int[]
*/
public static function get_effective_default_contextlevel_purpose_and_category($contextlevel, $forcedpurposevalue = false, $forcedcategoryvalue = false) {
public static function get_effective_default_contextlevel_purpose_and_category($contextlevel, $forcedpurposevalue = false,
$forcedcategoryvalue = false) {
list($purposeid, $categoryid) = self::get_defaults($contextlevel);

View file

@ -23,10 +23,7 @@
*/
namespace tool_dataprivacy;
use tool_dataprivacy\api;
use tool_dataprivacy\purpose;
use tool_dataprivacy\context_instance;
use tool_dataprivacy\data_registry;
use core_privacy\manager;
use tool_dataprivacy\expired_context;
defined('MOODLE_INTERNAL') || die();
@ -90,7 +87,7 @@ abstract class expired_contexts_manager {
return $numprocessed;
}
$privacymanager = new \core_privacy\manager();
$privacymanager = new manager();
$privacymanager->set_observer(new \tool_dataprivacy\manager_observer());
foreach ($this->get_context_levels() as $level) {
@ -118,11 +115,11 @@ abstract class expired_contexts_manager {
/**
* Deletes user data from the provided context.
*
* @param \core_privacy\manager $privacymanager
* @param \tool_dataprivacy\expired_context $expiredctx
* @param manager $privacymanager
* @param expired_context $expiredctx
* @return \context|false
*/
protected function delete_expired_context(\core_privacy\manager $privacymanager, \tool_dataprivacy\expired_context $expiredctx) {
protected function delete_expired_context(manager $privacymanager, expired_context $expiredctx) {
$context = \context::instance_by_id($expiredctx->get('contextid'), IGNORE_MISSING);
if (!$context) {

View file

@ -23,8 +23,7 @@
*/
namespace tool_dataprivacy;
use tool_dataprivacy\purpose;
use tool_dataprivacy\context_instance;
use core_privacy\manager;
defined('MOODLE_INTERNAL') || die();
@ -110,11 +109,11 @@ class expired_user_contexts extends \tool_dataprivacy\expired_contexts_manager {
*
* Overwritten to delete the user.
*
* @param \core_privacy\manager $privacymanager
* @param \tool_dataprivacy\expired_context $expiredctx
* @param manager $privacymanager
* @param expired_context $expiredctx
* @return \context|false
*/
protected function delete_expired_context(\core_privacy\manager $privacymanager, \tool_dataprivacy\expired_context $expiredctx) {
protected function delete_expired_context(manager $privacymanager, expired_context $expiredctx) {
$context = \context::instance_by_id($expiredctx->get('contextid'), IGNORE_MISSING);
if (!$context) {
api::delete_expired_context($expiredctx->get('contextid'));

View file

@ -27,6 +27,7 @@ defined('MOODLE_INTERNAL') || die();
use tool_dataprivacy\api;
use tool_dataprivacy\data_registry;
use tool_dataprivacy\purpose;
/**
* Context instance data form.
@ -186,12 +187,12 @@ class context_instance extends \core\form\persistent {
/**
* Returns the purpose display text.
*
* @param \tool_dataprivacy\purpose $effectivepurpose
* @param purpose $effectivepurpose
* @param int $retentioncontextlevel
* @param \context $context The context, just for displaying (filters) purposes.
* @return string
*/
protected static function get_retention_display_text(\tool_dataprivacy\purpose $effectivepurpose, $retentioncontextlevel, \context $context) {
protected static function get_retention_display_text(purpose $effectivepurpose, $retentioncontextlevel, \context $context) {
global $PAGE;
$renderer = $PAGE->get_renderer('tool_dataprivacy');

View file

@ -132,7 +132,7 @@ class helper {
'contextlevel' => CONTEXT_USER
];
// The final list of users that we will return;
// The final list of users that we will return.
$finalresults = [];
// Our prospective list of users.

View file

@ -64,7 +64,7 @@ class purpose extends \core\persistent {
// Replicate self::read.
$this->from_record($data);
// Using validate() as self::$validated is private.
// Validate the purpose record.
$this->validate();
// Now replicate the parent constructor.