Merge branch 'MDL-61731-33' of git://github.com/mihailges/moodle into MOODLE_33_STABLE
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Privacy class for requesting user data.
|
||||
*
|
||||
* @package message_email
|
||||
* @copyright 2018 Mihail Geshoski <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace message_email\privacy;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
use \core_privacy\local\metadata\collection;
|
||||
use \core_privacy\local\request\contextlist;
|
||||
use \core_privacy\local\request\approved_contextlist;
|
||||
|
||||
/**
|
||||
* Privacy class for requesting user data.
|
||||
*
|
||||
* @package message_email
|
||||
* @copyright 2018 Mihail Geshoski <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class provider implements \core_privacy\local\metadata\provider, \core_privacy\local\request\plugin\provider {
|
||||
|
||||
/**
|
||||
* Returns meta data about this system.
|
||||
*
|
||||
* @param collection $collection The initialised collection to add items to.
|
||||
* @return collection A listing of user data stored through this system.
|
||||
*/
|
||||
public static function get_metadata(collection $collection) {
|
||||
$collection->link_external_location('smtp', [
|
||||
'recipient' => 'privacy:metadata:recipient',
|
||||
'userfrom' => 'privacy:metadata:userfrom',
|
||||
'subject' => 'privacy:metadata:subject',
|
||||
'fullmessage' => 'privacy:metadata:fullmessage',
|
||||
'fullmessagehtml' => 'privacy:metadata:fullmessagehtml',
|
||||
'attachment' => 'privacy:metadata:attachment',
|
||||
'attachname' => 'privacy:metadata:attachname',
|
||||
'replyto' => 'privacy:metadata:replyto',
|
||||
'replytoname' => 'privacy:metadata:replytoname'
|
||||
], 'privacy:metadata:externalpurpose');
|
||||
|
||||
return $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of contexts that contain user information for the specified user.
|
||||
*
|
||||
* @param int $userid The user to search.
|
||||
* @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin.
|
||||
*/
|
||||
public static function get_contexts_for_userid($userid) {
|
||||
$contextlist = new contextlist();
|
||||
return $contextlist;
|
||||
}
|
||||
|
||||
/**
|
||||
* Export all user data for the specified user, in the specified contexts.
|
||||
*
|
||||
* @param approved_contextlist $contextlist The approved contexts to export information for.
|
||||
*/
|
||||
public static function export_user_data(approved_contextlist $contextlist) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all use data which matches the specified deletion_criteria.
|
||||
*
|
||||
* @param context $context A user context.
|
||||
*/
|
||||
public static function delete_data_for_all_users_in_context(\context $context) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all user data for the specified user, in the specified contexts.
|
||||
*
|
||||
* @param approved_contextlist $contextlist The approved contexts and user information to delete information for.
|
||||
*/
|
||||
public static function delete_data_for_user(approved_contextlist $contextlist) {
|
||||
}
|
||||
}
|
||||
@@ -26,3 +26,13 @@ $string['email'] = 'Send email notifications to';
|
||||
$string['emailonlyfromnoreplyaddress'] = 'Always send email from the no-reply address?';
|
||||
$string['ifemailleftempty'] = 'Leave empty to send notifications to {$a}';
|
||||
$string['pluginname'] = 'Email';
|
||||
$string['privacy:metadata:attachment'] = 'A file on the filesystem.';
|
||||
$string['privacy:metadata:attachname'] = 'The name of the attached file (extension indicates MIME).';
|
||||
$string['privacy:metadata:externalpurpose'] = 'This information is sent to an external SMTP server to be ultimately delivered as an email to the recipient.';
|
||||
$string['privacy:metadata:fullmessage'] = 'The full message in a given format.';
|
||||
$string['privacy:metadata:fullmessagehtml'] = 'The full version of the message.';
|
||||
$string['privacy:metadata:recipient'] = 'The recipient of the message.';
|
||||
$string['privacy:metadata:replyto'] = 'The email address to reply to.';
|
||||
$string['privacy:metadata:replytoname'] = 'Name of reply to recipient.';
|
||||
$string['privacy:metadata:subject'] = 'The subject line of the message.';
|
||||
$string['privacy:metadata:userfrom'] = 'The user sending the message.';
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
/**
|
||||
* Base class for unit tests for message_email.
|
||||
*
|
||||
* @package message_email
|
||||
* @copyright 2018 Mihail Geshoski <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
use \core_privacy\tests\provider_testcase;
|
||||
/**
|
||||
* Unit tests for message\output\email\classes\privacy\provider.php
|
||||
*
|
||||
* @copyright 2018 Mihail Geshoski <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class message_email_testcase extends provider_testcase {
|
||||
/**
|
||||
* Basic setup for these tests.
|
||||
*/
|
||||
public function setUp() {
|
||||
$this->resetAfterTest(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test returning metadata.
|
||||
*/
|
||||
public function test_get_metadata() {
|
||||
$collection = new \core_privacy\local\metadata\collection('message_email');
|
||||
$collection = \message_email\privacy\provider::get_metadata($collection);
|
||||
$this->assertNotEmpty($collection);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getting the context for the user ID related to this plugin.
|
||||
*/
|
||||
public function test_get_contexts_for_userid() {
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
|
||||
$contextlist = \message_email\privacy\provider::get_contexts_for_userid($user->id);
|
||||
$this->assertEmpty($contextlist);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user