Merge branch 'MDL-61889-master' of git://github.com/junpataleta/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2018-06-28 01:44:26 +02:00
commit d7a10f5746
23 changed files with 109 additions and 83 deletions

View File

@ -234,6 +234,7 @@ define(['jquery', 'core/str', 'core/ajax', 'core/notification', 'core/templates'
},
fail: Notification.exception
}]);
return;
}).catch(Notification.exception);
};

View File

@ -34,7 +34,6 @@ define(['jquery', 'core/url', 'core/str'], function($, url, str) {
*
* @param {object} targetnode The node that we want to expand / collapse
* @param {object} thisnode The node that was clicked.
* @return {null}
*/
expandCollapse: function(targetnode, thisnode) {
if (targetnode.hasClass('hide')) {
@ -58,7 +57,6 @@ define(['jquery', 'core/url', 'core/str'], function($, url, str) {
* Expand or collapse all nodes on this page.
*
* @param {string} nextstate The next state to change to.
* @return {null}
*/
expandCollapseAll: function(nextstate) {
var currentstate = (nextstate == 'visible') ? 'hide' : 'visible';
@ -75,6 +73,7 @@ define(['jquery', 'core/url', 'core/str'], function($, url, str) {
str.get_string(currentstate, 'tool_dataprivacy').then(function(langString) {
$('.tool_dataprivacy-expand-all').html(langString);
return;
}).catch(Notification.exception);
$(':header i.fa').each(function() {

View File

@ -24,6 +24,8 @@
require_once(__DIR__ . '/../../../config.php');
require_login(null, false);
$url = new moodle_url("/admin/tool/dataprivacy/categories.php");
$title = get_string('editcategories', 'tool_dataprivacy');

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.

View File

@ -25,6 +25,8 @@
require_once(__DIR__ . '/../../../config.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/tool/dataprivacy/lib.php');
require_login(null, false);
$filter = optional_param('filter', CONTEXT_COURSE, PARAM_INT);
$url = new moodle_url('/admin/tool/dataprivacy/datadeletion.php');

View File

@ -25,6 +25,8 @@
require_once(__DIR__ . '/../../../config.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/tool/dataprivacy/lib.php');
require_login(null, false);
$contextlevel = optional_param('contextlevel', CONTEXT_SYSTEM, PARAM_INT);
$contextid = optional_param('contextid', 0, PARAM_INT);

View File

@ -25,6 +25,8 @@
require_once("../../../config.php");
require_once('lib.php');
require_login(null, false);
$url = new moodle_url('/admin/tool/dataprivacy/datarequests.php');
$title = get_string('datarequests', 'tool_dataprivacy');

View File

@ -25,6 +25,8 @@
require_once(__DIR__ . '/../../../config.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/tool/dataprivacy/lib.php');
require_login(null, false);
$url = new \moodle_url('/admin/tool/dataprivacy/defaults.php');
$title = get_string('setdefaults', 'tool_dataprivacy');

View File

@ -24,6 +24,8 @@
require_once(__DIR__ . '/../../../config.php');
require_login(null, false);
$id = optional_param('id', 0, PARAM_INT);
$url = new \moodle_url('/admin/tool/dataprivacy/editcategory.php', array('id' => $id));

View File

@ -24,6 +24,8 @@
require_once(__DIR__ . '/../../../config.php');
require_login(null, false);
$id = optional_param('id', 0, PARAM_INT);
$url = new \moodle_url('/admin/tool/dataprivacy/editpurpose.php', array('id' => $id));

View File

@ -25,6 +25,8 @@
require_once(__DIR__ . '/../../../config.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/tool/dataprivacy/lib.php');
require_login(null, false);
$contextlevel = optional_param('contextlevel', CONTEXT_SYSTEM, PARAM_INT);
$contextid = optional_param('contextid', 0, PARAM_INT);

View File

@ -24,6 +24,8 @@
require_once(__DIR__ . '/../../../config.php');
require_login(null, false);
$url = new moodle_url("/admin/tool/dataprivacy/purposes.php");
$title = get_string('editpurposes', 'tool_dataprivacy');

View File

@ -46,7 +46,7 @@
}
}}
<div classs="container-fluid">
<div class="container-fluid">
<hr />
<div class="row">
{{#compliant}}
@ -64,17 +64,17 @@
</div>
{{#compliant}}
<div class="hide" data-section="{{raw_component}}" aria-expanded="false">
<div class="hide" data-section="{{raw_component}}" aria-expanded="false" role="contentinfo">
{{#metadata}}
<hr />
<div class="p-l-3">
<dl class="row">
<dt class="span3 col-xs-3">
{{#link}}
<a href="#{{name}}"><h5 style="word-wrap:break-word">{{name}}</h5></a>
<a href="#{{name}}"><strong style="word-wrap:break-word">{{name}}</strong></a>
{{/link}}
{{^link}}
<h5 style="word-wrap:break-word">{{name}}</h5>
<strong style="word-wrap:break-word">{{name}}</strong>
{{/link}}
<div class="small text-muted" style="word-wrap:break-word">{{type}}</div>
</dt>

File diff suppressed because one or more lines are too long

View File

@ -55,7 +55,7 @@
<h3 id="{{plugin_type_raw}}">{{#pix}}t/collapsed, moodle, {{#str}}expandplugintype, tool_dataprivacy{{/str}}{{/pix}}{{plugin_type}}</h3>
</a>
</div>
<div class="hide p-b-1" data-plugintarget="{{plugin_type_raw}}" aria-expanded="false">
<div class="hide p-b-1" data-plugintarget="{{plugin_type_raw}}" aria-expanded="false" role="contentinfo">
{{#plugins}}
{{> tool_dataprivacy/component_status}}
{{/plugins}}

View File

@ -47,59 +47,68 @@
"datarequestsurl": "#"
}
}}
<style>
table, th, td {
border: 1px solid black;
padding: 0.5em;
}
</style>
<div>
<p>{{#str}}emailsalutation, tool_dataprivacy, {{dponame}}{{/str}}</p>
<p>{{#str}}requestemailintro, tool_dataprivacy{{/str}}</p>
<table>
<tr>
<th scope="row">
{{#str}}requesttype, tool_dataprivacy{{/str}}
</th>
<td>
{{requesttype}}
</td>
</tr>
<tr>
<th scope="row">
{{#str}}requestfor, tool_dataprivacy{{/str}}
</th>
<td>
{{requestfor}}
</td>
</tr>
{{^forself}}
<tr>
<th scope="row">
{{#str}}requestby, tool_dataprivacy{{/str}}
</th>
<td>
{{requestedby}}
</td>
</tr>
{{/forself}}
<tr>
<th scope="row">
{{#str}}requestcomments, tool_dataprivacy{{/str}}
</th>
<td>
{{{requestcomments}}}
</td>
</tr>
<tr>
<th scope="row">
{{#str}}daterequested, tool_dataprivacy{{/str}}
</th>
<td>
{{requestdate}}
</td>
</tr>
</table>
<hr>
<a href="{{datarequestsurl}}">{{#str}}viewrequest, tool_dataprivacy{{/str}}</a>
</div>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
table, th, td {
border: 1px solid black;
padding: 0.5em;
}
</style>
<title>{{#str}}datarequestemailsubject, tool_dataprivacy, {{requesttype}}{{/str}}</title>
</head>
<body>
<div>
<p>{{#str}}emailsalutation, tool_dataprivacy, {{dponame}}{{/str}}</p>
<p>{{#str}}requestemailintro, tool_dataprivacy{{/str}}</p>
<table>
<tr>
<th scope="row">
{{#str}}requesttype, tool_dataprivacy{{/str}}
</th>
<td>
{{requesttype}}
</td>
</tr>
<tr>
<th scope="row">
{{#str}}requestfor, tool_dataprivacy{{/str}}
</th>
<td>
{{requestfor}}
</td>
</tr>
{{^forself}}
<tr>
<th scope="row">
{{#str}}requestby, tool_dataprivacy{{/str}}
</th>
<td>
{{requestedby}}
</td>
</tr>
{{/forself}}
<tr>
<th scope="row">
{{#str}}requestcomments, tool_dataprivacy{{/str}}
</th>
<td>
{{{requestcomments}}}
</td>
</tr>
<tr>
<th scope="row">
{{#str}}daterequested, tool_dataprivacy{{/str}}
</th>
<td>
{{requestdate}}
</td>
</tr>
</table>
<hr>
<a href="{{datarequestsurl}}">{{#str}}viewrequest, tool_dataprivacy{{/str}}</a>
</div>
</body>
</html>

View File

@ -30,6 +30,7 @@
Example context (json):
{
"title": "Data request modal title"
}
}}
{{< core/modal }}