Merge branch 'MDL-61568-master' of git://github.com/zig-moodle/moodle

This commit is contained in:
Andrew Nicols 2018-04-18 14:24:28 +08:00
commit 2babce1763
48 changed files with 2382 additions and 3 deletions

View File

@ -247,3 +247,12 @@ $string['unzipped'] = 'Unzipped successfully';
$string['wrongcontext'] = 'You cannot access to this context';
$string['xhtmlerror'] = 'You are probably using an XHTML strict header. Certain YUI components don\'t work in this mode; please turn it off.';
$string['ziped'] = 'Compress folder successfully';
$string['privacy:metadata:repository'] = 'The Repository component stores the repository types within the core subsystem.';
$string['privacy:metadata:repository_instances'] = 'The Repository plug-ins component stores user repository instances data within the core subsystem.';
$string['privacy:metadata:repository_instances:name'] = 'The custom name of the repository instance.';
$string['privacy:metadata:repository_instances:typeid'] = 'The ID type of the repository instance.';
$string['privacy:metadata:repository_instances:userid'] = 'The ID of the user owning the repository instance.';
$string['privacy:metadata:repository_instances:username'] = 'The optional username configured for the repository instance.';
$string['privacy:metadata:repository_instances:password'] = 'The optional password configured for the repository instance.';
$string['privacy:metadata:repository_instances:timecreated'] = 'The date/time of creation for the repository instance.';
$string['privacy:metadata:repository_instances:timemodified'] = 'The date/time of modification of the repository instance.';

View File

@ -0,0 +1,46 @@
<?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 Subsystem implementation for repository_areafiles.
*
* @package repository_areafiles
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace repository_areafiles\privacy;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for repository_areafiles implementing null_provider.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason() : string {
return 'privacy:metadata';
}
}

View File

@ -26,3 +26,4 @@ $string['areafiles:view'] = 'View repository Embedded files';
$string['configplugin'] = 'Configuration for repository Embedded files';
$string['pluginname_help'] = 'Files embedded in the current text editor';
$string['pluginname'] = 'Embedded files';
$string['privacy:metadata'] = 'The Embedded files repository plugin does not store or transmit any personal data.';

View File

@ -0,0 +1,94 @@
<?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 Subsystem implementation for repository_boxnet.
*
* @package repository_boxnet
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace repository_boxnet\privacy;
use core_privacy\local\metadata\collection;
use core_privacy\local\request\approved_contextlist;
use core_privacy\local\request\context;
use core_privacy\local\request\contextlist;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for repository_boxnet implementing metadata and plugin providers.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @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 {
$collection->add_external_location_link(
'box.com',
[
'query' => 'privacy:metadata:repository_boxnet:query'
],
'privacy:metadata:repository_boxnet'
);
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(int $userid) : contextlist {
return new 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 data for all users in the specified context.
*
* @param context $context The specific context to delete data for.
*/
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) {
}
}

View File

@ -40,4 +40,5 @@ $string['saved'] = 'Box data saved';
$string['shareurl'] = 'Share URL';
$string['username'] = 'Username for Box';
$string['warninghttps'] = 'Box requires your website to be using HTTPS in order for the repository to work.';
$string['privacy:metadata:repository_boxnet'] = 'The Box repository plugin does not store any personal data, but does transmit user data from Moodle to the remote system.';
$string['privacy:metadata:repository_boxnet:query'] = 'The Box repository user search text query.';

View File

@ -0,0 +1,193 @@
<?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 Subsystem implementation for core_repository.
*
* @package core_repository
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_repository\privacy;
use core_privacy\local\metadata\collection;
use core_privacy\local\request\approved_contextlist;
use core_privacy\local\request\context;
use core_privacy\local\request\contextlist;
use core_privacy\local\request\transform;
use core_privacy\local\request\writer;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for core_repository implementing metadata and plugin providers.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @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 {
$collection->add_database_table(
'repository_instances',
[
'name' => 'privacy:metadata:repository_instances:name',
'typeid' => 'privacy:metadata:repository_instances:typeid',
'userid' => 'privacy:metadata:repository_instances:userid',
'username' => 'privacy:metadata:repository_instances:username',
'password' => 'privacy:metadata:repository_instances:password',
'timecreated' => 'privacy:metadata:repository_instances:timecreated',
'timemodified' => 'privacy:metadata:repository_instances:timemodified',
],
'privacy:metadata:repository_instances'
);
$collection->add_plugintype_link('repository', [], 'privacy:metadata:repository');
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(int $userid) : contextlist {
$contextlist = new contextlist();
// The repository_instances data is associated at the user context level, so retrieve the user's context id.
$sql = "SELECT c.id
FROM {repository_instances} ri
JOIN {context} c ON c.instanceid = ri.userid AND c.contextlevel = :contextuser
WHERE ri.userid = :userid
GROUP BY c.id";
$params = [
'contextuser' => CONTEXT_USER,
'userid' => $userid
];
$contextlist->add_from_sql($sql, $params);
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) {
global $DB;
// If the user has repository_instances data, then only the User context should be present so get the first context.
$contexts = $contextlist->get_contexts();
if (count($contexts) == 0) {
return;
}
$context = reset($contexts);
// Sanity check that context is at the User context level, then get the userid.
if ($context->contextlevel !== CONTEXT_USER) {
return;
}
$userid = $context->instanceid;
$sql = "SELECT DISTINCT
ri.id as id,
r.type as type,
ri.name as name,
ri.timecreated as timecreated,
ri.timemodified as timemodified
FROM {repository_instances} ri
JOIN {repository} r ON r.id = ri.typeid
WHERE ri.userid = :userid";
$params = [
'userid' => $userid
];
$repositoryinstances = $DB->get_records_sql($sql, $params);
foreach ($repositoryinstances as $repositoryinstance) {
// The repository_instances data export is organised in: {User Context}/Repository plug-ins/{Plugin Name}/data.json.
$subcontext = [
get_string('plugin', 'core_repository'),
get_string('pluginname', 'repository_' . $repositoryinstance->type)
];
$data = (object) [
'type' => $repositoryinstance->type,
'name' => $repositoryinstance->name,
'timecreated' => transform::datetime($repositoryinstance->timecreated),
'timemodified' => transform::datetime($repositoryinstance->timemodified)
];
writer::with_context($context)->export_data($subcontext, $data);
}
}
/**
* Delete all data for all users in the specified context.
*
* @param context $context The specific context to delete data for.
*/
public static function delete_data_for_all_users_in_context(\context $context) {
global $DB;
// Sanity check that context is at the User context level, then get the userid.
if ($context->contextlevel !== CONTEXT_USER) {
return;
}
$userid = $context->instanceid;
// Delete the repository_instances records created for the userid.
$DB->delete_records('repository_instances', ['userid' => $userid]);
}
/**
* 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) {
global $DB;
// If the user has repository_instances data, then only the User context should be present so get the first context.
$contexts = $contextlist->get_contexts();
if (count($contexts) == 0) {
return;
}
$context = reset($contexts);
// Sanity check that context is at the User context level, then get the userid.
if ($context->contextlevel !== CONTEXT_USER) {
return;
}
$userid = $context->instanceid;
// Delete the repository_instances records created for the userid.
$DB->delete_records('repository_instances', ['userid' => $userid]);
}
}

View File

@ -0,0 +1,46 @@
<?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 Subsystem implementation for repository_coursefiles.
*
* @package repository_coursefiles
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace repository_coursefiles\privacy;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for repository_coursefiles implementing null_provider.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason() : string {
return 'privacy:metadata';
}
}

View File

@ -30,3 +30,4 @@ $string['remember'] = 'Remember me';
$string['pluginname_help'] = 'Legacy course files';
$string['pluginname'] = 'Legacy course files';
$string['coursefiles:view'] = 'Use course files repository plugin';
$string['privacy:metadata'] = 'The Legacy course files repository plugin does not store or transmit any personal data.';

View File

@ -0,0 +1,94 @@
<?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 Subsystem implementation for repository_dropbox.
*
* @package repository_dropbox
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace repository_dropbox\privacy;
use core_privacy\local\metadata\collection;
use core_privacy\local\request\approved_contextlist;
use core_privacy\local\request\context;
use core_privacy\local\request\contextlist;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for repository_dropbox implementing metadata and plugin providers.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @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 {
$collection->add_external_location_link(
'dropbox.com',
[
'query' => 'privacy:metadata:repository_dropbox:query'
],
'privacy:metadata:repository_dropbox'
);
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(int $userid) : contextlist {
return new 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 data for all users in the specified context.
*
* @param context $context The specific context to delete data for.
*/
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) {
}
}

View File

@ -35,3 +35,5 @@ $string['cachelimit_info'] = 'Enter the maximum size of files (in bytes) to be c
$string['dropbox:view'] = 'View a Dropbox folder';
$string['logoutdesc'] = '(Logout when you finish using Dropbox)';
$string['oauth2redirecturi'] = 'OAuth 2 Redirect URI';
$string['privacy:metadata:repository_dropbox'] = 'The Dropbox repository plugin does not store any personal data, but does transmit user data from Moodle to the remote system.';
$string['privacy:metadata:repository_dropbox:query'] = 'The Dropbox repository user search text query.';

View File

@ -0,0 +1,46 @@
<?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 Subsystem implementation for repository_equella.
*
* @package repository_equella
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace repository_equella\privacy;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for repository_equella implementing null_provider.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason() : string {
return 'privacy:metadata';
}
}

View File

@ -46,3 +46,4 @@ $string['group'] = '{$a} role settings';
$string['groupdefault'] = 'Default';
$string['sharedidtitle'] = 'Shared secret ID';
$string['sharedsecrettitle'] = 'Shared secret';
$string['privacy:metadata'] = 'The EQUELLA repository plugin does not store any personal data, but does transmit user data from Moodle to the remote system.';

View File

@ -0,0 +1,46 @@
<?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 Subsystem implementation for repository_filesystem.
*
* @package repository_filesystem
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace repository_filesystem\privacy;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for repository_filesystem implementing null_provider.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason() : string {
return 'privacy:metadata';
}
}

View File

@ -39,4 +39,4 @@ $string['pluginname'] = 'File system';
$string['searchresults'] = 'Search results';
$string['enablecourseinstances'] = 'Allow admins to add a file system repository instance to a course (configurable only by admins)';
$string['enableuserinstances'] = 'Allow admins to add a file system repository instance for personal use (configurable only by admins)';
$string['privacy:metadata'] = 'The File system repository plugin does not store or transmit any personal data.';

View File

@ -0,0 +1,134 @@
<?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 Subsystem implementation for repository_flickr.
*
* @package repository_flickr
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace repository_flickr\privacy;
use core_privacy\local\metadata\collection;
use core_privacy\local\request\approved_contextlist;
use core_privacy\local\request\context;
use core_privacy\local\request\contextlist;
use core_privacy\local\request\writer;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for repository_flickr implementing metadata, plugin, and user_preference providers.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @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,
\core_privacy\local\request\user_preference_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 {
$collection->add_external_location_link(
'flickr.com',
[
'text' => 'privacy:metadata:repository_flickr:text'
],
'privacy:metadata:repository_flickr'
);
// Flickr preferences.
$collection->add_user_preference(
'repository_flickr_access_token',
'privacy:metadata:repository_flickr:preference:repository_flickr_access_token'
);
$collection->add_user_preference(
'repository_flickr_access_token_secret',
'privacy:metadata:repository_flickr:preference:repository_flickr_access_token_secret'
);
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(int $userid) : contextlist {
return new 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 data for all users in the specified context.
*
* @param context $context The specific context to delete data for.
*/
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) {
}
/**
* Export all user preferences for the plugin.
*
* @param int $userid The userid of the user whose data is to be exported.
*/
public static function export_user_preferences(int $userid) {
$accesstoken = get_user_preferences('repository_flickr_access_token', null, $userid);
if ($accesstoken !== null) {
writer::export_user_preference(
'repository_flickr',
'repository_flickr_access_token',
$accesstoken,
get_string('privacy:metadata:repository_flickr:preference:repository_flickr_access_token', 'repository_flickr')
);
}
$accesstokensecret = get_user_preferences('repository_flickr_access_token_secret', null, $userid);
if ($accesstokensecret !== null) {
writer::export_user_preference(
'repository_flickr',
'repository_flickr_access_token_secret',
$accesstokensecret,
get_string('privacy:metadata:repository_flickr:preference:repository_flickr_access_token_secret', 'repository_flickr')
);
}
}
}

View File

@ -43,3 +43,7 @@ $string['pluginname_help'] = 'Repository on flickr.com';
$string['pluginname'] = 'Flickr';
$string['secret'] = 'Secret';
$string['username'] = 'Flickr account email';
$string['privacy:metadata:repository_flickr'] = 'The Flickr repository plugin does store user preferences, and transmits user data from Moodle to the remote system.';
$string['privacy:metadata:repository_flickr:text'] = 'The Flickr repository user search text query.';
$string['privacy:metadata:repository_flickr:preference:repository_flickr_access_token'] = 'The Flickr repository user preference OAuth token.';
$string['privacy:metadata:repository_flickr:preference:repository_flickr_access_token_secret'] = 'The Flickr repository user preference OAuth secret.';

View File

@ -0,0 +1,97 @@
<?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 Subsystem implementation for repository_flickr_public.
*
* @package repository_flickr_public
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace repository_flickr_public\privacy;
use core_privacy\local\metadata\collection;
use core_privacy\local\request\approved_contextlist;
use core_privacy\local\request\context;
use core_privacy\local\request\contextlist;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for repository_flickr_public implementing metadata and plugin providers.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @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 {
$collection->add_external_location_link(
'flickr.com',
[
'author' => 'privacy:metadata:repository_flickr_public:author',
'email_address' => 'privacy:metadata:repository_flickr_public:email_address',
'text' => 'privacy:metadata:repository_flickr_public:text',
'user_id' => 'privacy:metadata:repository_flickr_public:user_id'
],
'privacy:metadata:repository_flickr_public'
);
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(int $userid) : contextlist {
return new 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 data for all users in the specified context.
*
* @param context $context The specific context to delete data for.
*/
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) {
}
}

View File

@ -53,3 +53,8 @@ $string['sharealike'] = 'Yes, as long as others share alike';
$string['tag'] = 'Tag';
$string['username'] = 'Flickr account email';
$string['watermark'] = 'Add watermark to photos';
$string['privacy:metadata:repository_flickr_public'] = 'The Flickr public repository plugin does not store any personal data, but does transmit user data from Moodle to the remote system.';
$string['privacy:metadata:repository_flickr_public:author'] = 'The Flickr public repository content author.';
$string['privacy:metadata:repository_flickr_public:email_address'] = 'The Flickr public repository user email address.';
$string['privacy:metadata:repository_flickr_public:text'] = 'The Flickr public repository user search text.';
$string['privacy:metadata:repository_flickr_public:user_id'] = 'The Flickr public repository user id.';

View File

@ -0,0 +1,96 @@
<?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 Subsystem implementation for repository_googledocs.
*
* @package repository_googledocs
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace repository_googledocs\privacy;
use core_privacy\local\metadata\collection;
use core_privacy\local\request\approved_contextlist;
use core_privacy\local\request\context;
use core_privacy\local\request\contextlist;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for repository_googledocs implementing metadata and plugin providers.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @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 {
$collection->add_external_location_link(
'drive.google.com',
[
'email' => 'privacy:metadata:repository_googledocs:email',
'searchtext' => 'privacy:metadata:repository_googledocs:searchtext'
],
'privacy:metadata:repository_googledocs'
);
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(int $userid) : contextlist {
return new 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 data for all users in the specified context.
*
* @param context $context The specific context to delete data for.
*/
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) {
}
}

View File

@ -43,6 +43,9 @@ $string['defaultreturntype'] = 'Default return type';
$string['fileoptions'] = 'The types and defaults for returned files is configurable here. Note that all files linked externally will be updated so that the owner is the Moodle system account.';
$string['owner'] = 'Owned by: {$a}';
$string['cachedef_folder'] = 'Google file IDs for folders in the system account';
$string['privacy:metadata:repository_googledocs'] = 'The Google Drive repository plugin does not store any personal data, but does transmit user data from Moodle to the remote system.';
$string['privacy:metadata:repository_googledocs:email'] = 'The email of the Google Drive repository user.';
$string['privacy:metadata:repository_googledocs:searchtext'] = 'The Google Drive repository user search text query.';
// Deprecated since Moodle 3.3.
$string['oauthinfo'] = '<p>To use this plugin, you must register your site with Google, as described in the documentation <a href="{$a->docsurl}">Google OAuth 2.0 setup</a>.</p><p>As part of the registration process, you will need to enter the following URL as \'Authorized Redirect URIs\':</p><p>{$a->callbackurl}</p><p>Once registered, you will be provided with a client ID and secret which can be used to configure certain other Google Drive and Picasa plugins.</p><p>Please also note that you will have to enable the service \'Drive API\'.</p>';

View File

@ -0,0 +1,46 @@
<?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 Subsystem implementation for repository_local.
*
* @package repository_local
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace repository_local\privacy;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for repository_local implementing null_provider.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason() : string {
return 'privacy:metadata';
}
}

View File

@ -31,3 +31,4 @@ $string['notitle'] = 'notitle';
$string['remember'] = 'Remember me';
$string['pluginname_help'] = 'Files previously uploaded to the Moodle server';
$string['pluginname'] = 'Server files';
$string['privacy:metadata'] = 'The Server files repository plugin does not store or transmit any personal data.';

View File

@ -0,0 +1,96 @@
<?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 Subsystem implementation for repository_merlot.
*
* @package repository_merlot
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace repository_merlot\privacy;
use core_privacy\local\metadata\collection;
use core_privacy\local\request\approved_contextlist;
use core_privacy\local\request\context;
use core_privacy\local\request\contextlist;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for repository_merlot implementing metadata and plugin providers.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @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 {
$collection->add_external_location_link(
'merlot.org',
[
'author' => 'privacy:metadata:repository_merlot:author',
'keywords' => 'privacy:metadata:repository_merlot:keywords',
'licencekey' => 'privacy:metadata:repository_merlot:licencekey'
],
'privacy:metadata:repository_merlot'
);
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(int $userid) : contextlist {
return new 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 data for all users in the specified context.
*
* @param context $context The specific context to delete data for.
*/
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) {
}
}

View File

@ -28,3 +28,7 @@ $string['licensekey'] = 'License key';
$string['pluginname_help'] = 'Merlot.org';
$string['pluginname'] = 'Merlot.org';
$string['merlot:view'] = 'View the Merlot repository';
$string['privacy:metadata:repository_merlot'] = 'The Merlot.org repository plugin does not store any personal data, but does transmit user data from Moodle to the remote system.';
$string['privacy:metadata:repository_merlot:author'] = 'The Merlot.org repository content author.';
$string['privacy:metadata:repository_merlot:keywords'] = 'The Merlot.org repository user search text query.';
$string['privacy:metadata:repository_merlot:licencekey'] = 'The Merlot.org repository licence key.';

View File

@ -0,0 +1,199 @@
<?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 Subsystem implementation for repository_onedrive.
*
* @package repository_onedrive
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace repository_onedrive\privacy;
use core_privacy\local\metadata\collection;
use core_privacy\local\request\approved_contextlist;
use core_privacy\local\request\context;
use core_privacy\local\request\contextlist;
use core_privacy\local\request\transform;
use \core_privacy\local\request\writer;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for repository_onedrive implementing metadata and plugin providers.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @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 {
$collection->add_external_location_link(
'onedrive.live.com',
[
'searchtext' => 'privacy:metadata:repository_onedrive:searchtext'
],
'privacy:metadata:repository_onedrive'
);
// The repository_onedrive has a 'repository_onedrive_access' table that contains user data.
$collection->add_database_table(
'repository_onedrive_access',
[
'itemid' => 'privacy:metadata:repository_onedrive:repository_onedrive_access:itemid',
'permissionid' => 'privacy:metadata:repository_onedrive:repository_onedrive_access:permissionid',
'timecreated' => 'privacy:metadata:repository_onedrive:repository_onedrive_access:timecreated',
'timemodified' => 'privacy:metadata:repository_onedrive:repository_onedrive_access:timemodified',
'usermodified' => 'privacy:metadata:repository_onedrive:repository_onedrive_access:usermodified'
],
'privacy:metadata:repository_onedrive'
);
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(int $userid) : contextlist {
$contextlist = new contextlist();
// The data is associated at the user context level, so retrieve the user's context id.
$sql = "SELECT c.id
FROM {repository_onedrive_access} roa
JOIN {context} c ON c.instanceid = roa.usermodified AND c.contextlevel = :contextuser
WHERE roa.usermodified = :userid
GROUP BY c.id";
$params = [
'contextuser' => CONTEXT_USER,
'userid' => $userid
];
$contextlist->add_from_sql($sql, $params);
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) {
global $DB;
// If the user has data, then only the User context should be present so get the first context.
$contexts = $contextlist->get_contexts();
if (count($contexts) == 0) {
return;
}
$context = reset($contexts);
// Sanity check that context is at the User context level, then get the userid.
if ($context->contextlevel !== CONTEXT_USER) {
return;
}
$userid = $context->instanceid;
$sql = "SELECT roa.id as id,
roa.itemid as itemid,
roa.permissionid as permissionid,
roa.timecreated as timecreated,
roa.timemodified as timemodified
FROM {repository_onedrive_access} roa
WHERE roa.usermodified = :userid";
$params = [
'userid' => $userid
];
$onedriveaccesses = $DB->get_records_sql($sql, $params);
$index = 0;
foreach ($onedriveaccesses as $onedriveaccess) {
// Data export is organised in: {User Context}/Repository plug-ins/{Plugin Name}/Access/{index}/data.json.
$index++;
$subcontext = [
get_string('plugin', 'core_repository'),
get_string('pluginname', 'repository_onedrive'),
get_string('access', 'repository_onedrive'),
$index
];
$data = (object) [
'itemid' => $onedriveaccess->itemid,
'permissionid' => $onedriveaccess->permissionid,
'timecreated' => transform::datetime($onedriveaccess->timecreated),
'timemodified' => transform::datetime($onedriveaccess->timemodified)
];
writer::with_context($context)->export_data($subcontext, $data);
}
}
/**
* Delete all data for all users in the specified context.
*
* @param context $context The specific context to delete data for.
*/
public static function delete_data_for_all_users_in_context(\context $context) {
global $DB;
// Sanity check that context is at the User context level, then get the userid.
if ($context->contextlevel !== CONTEXT_USER) {
return;
}
$userid = $context->instanceid;
$DB->delete_records('repository_onedrive_access', ['usermodified' => $userid]);
}
/**
* 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) {
global $DB;
// If the user has data, then only the User context should be present so get the first context.
$contexts = $contextlist->get_contexts();
if (count($contexts) == 0) {
return;
}
$context = reset($contexts);
// Sanity check that context is at the User context level, then get the userid.
if ($context->contextlevel !== CONTEXT_USER) {
return;
}
$userid = $context->instanceid;
$DB->delete_records('repository_onedrive_access', ['usermodified' => $userid]);
}
}

View File

@ -23,6 +23,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['access'] = 'Access';
$string['both'] = 'Internal and external';
$string['cachedef_folder'] = 'OneDrive file IDs for folders in the system account';
$string['configplugin'] = 'Configure OneDrive plugin';
@ -46,3 +47,10 @@ $string['skydrivefilesimported'] = 'All files were imported from the Microsoft S
$string['skydrivefilesnotimported'] = 'Some files could not be imported from the Microsoft SkyDrive repository.';
$string['onedrive:view'] = 'View OneDrive repository';
$string['supportedreturntypes'] = 'Supported files';
$string['privacy:metadata:repository_onedrive'] = 'The Microsoft OneDrive repository stores temporary access grants, and transmits user data from Moodle to the remote system.';
$string['privacy:metadata:repository_onedrive:searchtext'] = 'The Microsoft OneDrive repository user search text query.';
$string['privacy:metadata:repository_onedrive:repository_onedrive_access:itemid'] = 'The Microsoft OneDrive with a temporary access grant item ID.';
$string['privacy:metadata:repository_onedrive:repository_onedrive_access:permissionid'] = 'The Microsoft OneDrive temporary access grant permission ID.';
$string['privacy:metadata:repository_onedrive:repository_onedrive_access:timecreated'] = 'The Microsoft OneDrive temporary access grant creation date/time.';
$string['privacy:metadata:repository_onedrive:repository_onedrive_access:timemodified'] = 'The Microsoft OneDrive temporary access grant modification date/time.';
$string['privacy:metadata:repository_onedrive:repository_onedrive_access:usermodified'] = 'The ID of the user modifying the Microsoft OneDrive temporary access grant.';

View File

@ -0,0 +1,256 @@
<?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/>.
/**
* Unit tests for the repository_onedrive implementation of the privacy API.
*
* @package repository_onedrive
* @category test
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
use \core_privacy\local\metadata\collection;
use \core_privacy\local\request\writer;
use \core_privacy\local\request\approved_contextlist;
use \repository_onedrive\privacy\provider;
/**
* Unit tests for the repository_onedrive implementation of the privacy API.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class repository_onedrive_privacy_testcase extends \core_privacy\tests\provider_testcase {
/**
* Overriding setUp() function to always reset after tests.
*/
public function setUp() {
$this->resetAfterTest(true);
}
/**
* Test for provider::get_contexts_for_userid().
*/
public function test_get_contexts_for_userid() {
global $DB;
// Test setup.
$user = $this->getDataGenerator()->create_user();
$this->setUser($user);
// Add two repository_onedrive_access records for the User.
$access = (object)[
'usermodified' => $user->id,
'itemid' => 'Some onedrive access item data',
'permissionid' => 'Some onedrive access permission data',
'timecreated' => date('u'),
'timemodified' => date('u'),
];
$DB->insert_record('repository_onedrive_access', $access);
$access = (object)[
'usermodified' => $user->id,
'itemid' => 'Another onedrive access item data',
'permissionid' => 'Another onedrive access permission data',
'timecreated' => date('u'),
'timemodified' => date('u'),
];
$DB->insert_record('repository_onedrive_access', $access);
// Test there are two repository_onedrive_access records for the User.
$access = $DB->get_records('repository_onedrive_access', ['usermodified' => $user->id]);
$this->assertCount(2, $access);
// Test the User's retrieved contextlist contains only one context.
$contextlist = provider::get_contexts_for_userid($user->id);
$contexts = $contextlist->get_contexts();
$this->assertCount(1, $contexts);
// Test the User's contexts equal the User's own context.
$context = reset($contexts);
$this->assertEquals(CONTEXT_USER, $context->contextlevel);
$this->assertEquals($user->id, $context->instanceid);
}
/**
* Test for provider::export_user_data().
*/
public function test_export_user_data() {
global $DB;
// Test setup.
$user = $this->getDataGenerator()->create_user();
$this->setUser($user);
// Add two repository_onedrive_access records for the User.
$access = (object)[
'usermodified' => $user->id,
'itemid' => 'Some onedrive access item data',
'permissionid' => 'Some onedrive access permission data',
'timecreated' => date('u'),
'timemodified' => date('u'),
];
$DB->insert_record('repository_onedrive_access', $access);
$access = (object)[
'usermodified' => $user->id,
'itemid' => 'Another onedrive access item data',
'permissionid' => 'Another onedrive access permission data',
'timecreated' => date('u'),
'timemodified' => date('u'),
];
$DB->insert_record('repository_onedrive_access', $access);
// Test there are two repository_onedrive_access records for the User.
$access = $DB->get_records('repository_onedrive_access', ['usermodified' => $user->id]);
$this->assertCount(2, $access);
// Test the User's retrieved contextlist contains only one context.
$contextlist = provider::get_contexts_for_userid($user->id);
$contexts = $contextlist->get_contexts();
$this->assertCount(1, $contexts);
// Test the User's contexts equal the User's own context.
$context = reset($contexts);
$this->assertEquals(CONTEXT_USER, $context->contextlevel);
$this->assertEquals($user->id, $context->instanceid);
$approvedcontextlist = new approved_contextlist($user, 'repository_onedrive', $contextlist->get_contextids());
// Retrieve repository_onedrive_access data only for this user.
provider::export_user_data($approvedcontextlist);
// Test the repository_onedrive_access data is exported at the User context level.
$user = $approvedcontextlist->get_user();
$contextuser = context_user::instance($user->id);
$writer = writer::with_context($contextuser);
$this->assertTrue($writer->has_any_data());
}
/**
* Test for provider::delete_data_for_all_users_in_context().
*/
public function test_delete_data_for_all_users_in_context() {
global $DB;
// Test setup.
$user = $this->getDataGenerator()->create_user();
$this->setUser($user);
// Add two repository_onedrive_access records for the User.
$access = (object)[
'usermodified' => $user->id,
'itemid' => 'Some onedrive access item data',
'permissionid' => 'Some onedrive access permission data',
'timecreated' => date('u'),
'timemodified' => date('u'),
];
$DB->insert_record('repository_onedrive_access', $access);
$access = (object)[
'usermodified' => $user->id,
'itemid' => 'Another onedrive access item data',
'permissionid' => 'Another onedrive access permission data',
'timecreated' => date('u'),
'timemodified' => date('u'),
];
$DB->insert_record('repository_onedrive_access', $access);
// Test there are two repository_onedrive_access records for the User.
$access = $DB->get_records('repository_onedrive_access', ['usermodified' => $user->id]);
$this->assertCount(2, $access);
// Test the User's retrieved contextlist contains only one context.
$contextlist = provider::get_contexts_for_userid($user->id);
$contexts = $contextlist->get_contexts();
$this->assertCount(1, $contexts);
// Test the User's contexts equal the User's own context.
$context = reset($contexts);
$this->assertEquals(CONTEXT_USER, $context->contextlevel);
$this->assertEquals($user->id, $context->instanceid);
// Test delete all users content by context.
provider::delete_data_for_all_users_in_context($context);
$access = $DB->get_records('repository_onedrive_access', ['usermodified' => $user->id]);
$this->assertCount(0, $access);
}
/**
* Test for provider::delete_data_for_user().
*/
public function test_delete_data_for_user() {
global $DB;
// Test setup.
$user1 = $this->getDataGenerator()->create_user();
$user2 = $this->getDataGenerator()->create_user();
$this->setUser($user1);
// Add 3 repository_onedrive_accesss records for User 1.
$noaccess = 3;
for ($a = 0; $a < $noaccess; $a++) {
$access = (object)[
'usermodified' => $user1->id,
'itemid' => 'Some onedrive access item data - ' . $a,
'permissionid' => 'Some onedrive access permission data - ' . $a,
'timecreated' => date('u'),
'timemodified' => date('u'),
];
$DB->insert_record('repository_onedrive_access', $access);
}
// Add 1 repository_onedrive_accesss record for User 2.
$access = (object)[
'usermodified' => $user2->id,
'itemid' => 'Some onedrive access item data',
'permissionid' => 'Some onedrive access permission data',
'timecreated' => date('u'),
'timemodified' => date('u'),
];
$DB->insert_record('repository_onedrive_access', $access);
// Test the created repository_onedrive records for User 1 equals test number of access specified.
$communities = $DB->get_records('repository_onedrive_access', ['usermodified' => $user1->id]);
$this->assertCount($noaccess, $communities);
// Test the created repository_onedrive records for User 2 equals 1.
$communities = $DB->get_records('repository_onedrive_access', ['usermodified' => $user2->id]);
$this->assertCount(1, $communities);
// Test the deletion of repository_onedrive_access records for User 1 results in zero records.
$contextlist = provider::get_contexts_for_userid($user1->id);
$contexts = $contextlist->get_contexts();
$this->assertCount(1, $contexts);
// Test the User's contexts equal the User's own context.
$context = reset($contexts);
$this->assertEquals(CONTEXT_USER, $context->contextlevel);
$this->assertEquals($user1->id, $context->instanceid);
$approvedcontextlist = new approved_contextlist($user1, 'repository_onedrive', $contextlist->get_contextids());
provider::delete_data_for_user($approvedcontextlist);
$access = $DB->get_records('repository_onedrive_access', ['usermodified' => $user1->id]);
$this->assertCount(0, $access);
// Test that User 2's single repository_onedrive_access record still exists.
$contextlist = provider::get_contexts_for_userid($user2->id);
$contexts = $contextlist->get_contexts();
$this->assertCount(1, $contexts);
// Test the User's contexts equal the User's own context.
$context = reset($contexts);
$this->assertEquals(CONTEXT_USER, $context->contextlevel);
$this->assertEquals($user2->id, $context->instanceid);
$access = $DB->get_records('repository_onedrive_access', ['usermodified' => $user2->id]);
$this->assertCount(1, $access);
}
}

View File

@ -0,0 +1,94 @@
<?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 Subsystem implementation for repository_picasa.
*
* @package repository_picasa
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace repository_picasa\privacy;
use core_privacy\local\metadata\collection;
use core_privacy\local\request\approved_contextlist;
use core_privacy\local\request\context;
use core_privacy\local\request\contextlist;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for repository_picasa implementing metadata and plugin providers.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @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 {
$collection->add_external_location_link(
'picasa.google.com',
[
'search_text' => 'privacy:metadata:repository_picasa:searchtext'
],
'privacy:metadata:repository_picasa'
);
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(int $userid) : contextlist {
return new 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 data for all users in the specified context.
*
* @param context $context The specific context to delete data for.
*/
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) {
}
}

View File

@ -28,3 +28,5 @@ $string['oauthinfo'] = '<p>To use this plugin, you must register your site with
$string['picasa:view'] = 'View picasa repository';
$string['pluginname'] = 'Picasa web album';
$string['secret'] = 'Secret';
$string['privacy:metadata:repository_picasa'] = 'The Picasa web album repository plugin does not store any personal data, but does transmit user data from Moodle to the remote system.';
$string['privacy:metadata:repository_picasa:searchtext'] = 'The Picasa repository user search text query.';

View File

@ -0,0 +1,46 @@
<?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 Subsystem implementation for repository_recent.
*
* @package repository_recent
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace repository_recent\privacy;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for repository_recent implementing null_provider.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason() : string {
return 'privacy:metadata';
}
}

View File

@ -30,3 +30,4 @@ $string['notitle'] = 'notitle';
$string['recent:view'] = 'View recent files repository plugin';
$string['pluginname_help'] = 'Files recently used by current user';
$string['pluginname'] = 'Recent files';
$string['privacy:metadata'] = 'The Recent files repository plugin does not store or transmit any personal data.';

View File

@ -0,0 +1,46 @@
<?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 Subsystem implementation for repository_s3.
*
* @package repository_s3
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace repository_s3\privacy;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for repository_s3 implementing null_provider.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason() : string {
return 'privacy:metadata';
}
}

View File

@ -30,3 +30,4 @@ $string['needaccesskey'] = 'Access key must be provided';
$string['pluginname'] = 'Amazon S3';
$string['secret_key'] = 'Secret key';
$string['s3:view'] = 'View amazon s3 repository';
$string['privacy:metadata'] = 'The Amazon S3 repository plugin does not store any personal data, but does transmit user data from Moodle to the remote system.';

View File

@ -0,0 +1,46 @@
<?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 Subsystem implementation for repository_skydrive.
*
* @package repository_skydrive
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace repository_skydrive\privacy;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for repository_skydrive implementing null_provider.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason() : string {
return 'privacy:metadata';
}
}

View File

@ -30,3 +30,4 @@ $string['pluginname'] = 'Microsoft OneDrive (legacy)';
$string['secret'] = 'Secret';
$string['skydrive:view'] = 'View OneDrive (legacy)';
$string['deprecatedwarning'] = 'Warning: The API used by this repository plugin has been deprecated by Microsoft and it will stop working eventually. Please migrate to the newer "Microsoft OneDrive" repository.';
$string['privacy:metadata'] = 'The Microsoft OneDrive (legacy) repository plugin does not store any personal data, but does transmit user data from Moodle to the remote system.';

View File

@ -0,0 +1,190 @@
<?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/>.
/**
* Unit tests for the core_repository implementation of the privacy API.
*
* @package core_repository
* @category test
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
use \core_privacy\local\metadata\collection;
use \core_privacy\local\request\writer;
use \core_privacy\local\request\approved_contextlist;
use \core_repository\privacy\provider;
/**
* Unit tests for the core_repository implementation of the privacy API.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class core_repository_privacy_testcase extends \core_privacy\tests\provider_testcase {
/**
* Overriding setUp() function to always reset after tests.
*/
public function setUp() {
$this->resetAfterTest(true);
}
/**
* Test for provider::get_contexts_for_userid().
*/
public function test_get_contexts_for_userid() {
// Test setup.
$user = $this->getDataGenerator()->create_user();
$this->setUser($user);
// Test the User's retrieved contextlist is empty because no repository_instances have added for the User yet.
$contextlist = provider::get_contexts_for_userid($user->id);
$contexts = $contextlist->get_contexts();
$this->assertCount(0, $contexts);
// Create 3 repository_instances records for the User.
$this->setup_test_scenario_data($user->id, 3);
// Test the User's retrieved contextlist contains only one context.
$contextlist = provider::get_contexts_for_userid($user->id);
$contexts = $contextlist->get_contexts();
$this->assertCount(1, $contexts);
// Test the User's contexts equal the User's own context.
$context = reset($contexts);
$this->assertEquals(CONTEXT_USER, $context->contextlevel);
$this->assertEquals($user->id, $context->instanceid);
}
/**
* Test for provider::export_user_data().
*/
public function test_export_user_data() {
// Test setup.
$user = $this->getDataGenerator()->create_user();
$this->setUser($user);
// Create 3 repository_instances records for the User.
$this->setup_test_scenario_data($user->id, 3);
// Test the User's retrieved contextlist contains only one context.
$contextlist = provider::get_contexts_for_userid($user->id);
$contexts = $contextlist->get_contexts();
$this->assertCount(1, $contexts);
// Test the User's contexts equal the User's own context.
$context = reset($contexts);
$this->assertEquals(CONTEXT_USER, $context->contextlevel);
$this->assertEquals($user->id, $context->instanceid);
// Retrieve repository_instances data only for this user.
$approvedcontextlist = new approved_contextlist($user, 'core_repository', $contextlist->get_contextids());
provider::export_user_data($approvedcontextlist);
// Test the repository_instances data is exported at the User context level.
$user = $approvedcontextlist->get_user();
$contextuser = context_user::instance($user->id);
$writer = writer::with_context($contextuser);
$this->assertTrue($writer->has_any_data());
}
/**
* Test for provider::delete_data_for_all_users_in_context().
*/
public function test_delete_data_for_all_users_in_context() {
global $DB;
// Test setup.
$user = $this->getDataGenerator()->create_user();
$this->setUser($user);
// Create 3 repository_instances records for the User.
$this->setup_test_scenario_data($user->id, 3);
// Test the User's retrieved contextlist contains only one context.
$contextlist = provider::get_contexts_for_userid($user->id);
$contexts = $contextlist->get_contexts();
$this->assertCount(1, $contexts);
// Test the User's contexts equal the User's own context.
$context = reset($contexts);
$this->assertEquals(CONTEXT_USER, $context->contextlevel);
// Delete all the User's records in mdl_repository_instances table by the specified User context.
provider::delete_data_for_all_users_in_context($context);
// Test the cohort roles records in mdl_repository_instances table is equals zero.
$repositoryinstances = $DB->get_records('repository_instances', ['userid' => $user->id]);
$this->assertCount(0, $repositoryinstances);
}
/**
* Test for provider::delete_data_for_user().
*/
public function test_delete_data_for_user() {
global $DB;
// Test setup.
$user = $this->getDataGenerator()->create_user();
$this->setUser($user);
// Create 3 repository_instances records for the User.
$this->setup_test_scenario_data($user->id, 3);
// Test the User's retrieved contextlist contains only one context.
$contextlist = provider::get_contexts_for_userid($user->id);
$contexts = $contextlist->get_contexts();
$this->assertCount(1, $contexts);
// Test the User's contexts equal the User's own context.
$context = reset($contexts);
$this->assertEquals(CONTEXT_USER, $context->contextlevel);
// Delete all the User's records in mdl_repository_instances table by the specified User approved context list.
$approvedcontextlist = new approved_contextlist($user, 'repository_instances', $contextlist->get_contextids());
provider::delete_data_for_user($approvedcontextlist);
// Test the cohort roles records in mdl_repository_instances table is equals zero.
$repositoryinstances = $DB->get_records('repository_instances', ['userid' => $user->id]);
$this->assertCount(0, $repositoryinstances);
}
/**
* Helper function to setup repository_instances records for testing a specific user.
*
* @param int $userid The Id of the User used for testing.
* @param int $noscenarios The number of repository_instance records to create for the User.
* @throws dml_exception
*/
private function setup_test_scenario_data($userid, $noscenarios) {
global $DB;
for ($i = 0; $i < $noscenarios; $i++) {
$repositoryinstance = (object)[
'typeid' => ($i + 1),
'name' => 'My Test Repo',
'userid' => $userid,
'contextid' => 1,
'username' => 'some username',
'password' => 'some password',
'timecreated' => date('u'),
'timemodified' => date('u'),
'readonly' => 0
];
$DB->insert_record('repository_instances', $repositoryinstance);
}
}
}

View File

@ -0,0 +1,46 @@
<?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 Subsystem implementation for repository_upload.
*
* @package repository_upload
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace repository_upload\privacy;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for repository_upload implementing null_provider.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason() : string {
return 'privacy:metadata';
}
}

View File

@ -34,4 +34,5 @@ $string['upload_error_no_file'] = 'No file was uploaded.';
$string['upload_error_no_tmp_dir'] = 'PHP is missing a temporary folder.';
$string['upload_error_cant_write'] = 'Failed to write file to disk.';
$string['upload_error_extension'] = 'A PHP extension stopped the file upload.';
$string['upload_error_invalid_file'] = 'The file \'{$a}\' is either empty or a folder. To upload folders zip them first.';
$string['upload_error_invalid_file'] = 'The file \'{$a}\' is either empty or a folder. To upload folders zip them first.';
$string['privacy:metadata'] = 'The Upload a file repository plugin does not store or transmit any personal data.';

View File

@ -0,0 +1,46 @@
<?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 Subsystem implementation for repository_url.
*
* @package repository_url
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace repository_url\privacy;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for repository_url implementing null_provider.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason() : string {
return 'privacy:metadata';
}
}

View File

@ -31,3 +31,4 @@ $string['url:view'] = 'Use URL downloader in file picker';
$string['validname'] = 'You must provide a valid file name';
$string['configplugin'] = 'URL repository type configuration';
$string['validfiletype'] = 'You must provide a URL to an image file or a page containing images.';
$string['privacy:metadata'] = 'The URL downloader repository plugin does not store or tranmit any personal data.';

View File

@ -0,0 +1,46 @@
<?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 Subsystem implementation for repository_user.
*
* @package repository_user
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace repository_user\privacy;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for repository_user implementing null_provider.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason() : string {
return 'privacy:metadata';
}
}

View File

@ -29,3 +29,4 @@ $string['pluginname_help'] = 'Files in user private area';
$string['pluginname'] = 'Private files';
$string['emptyfilelist'] = 'There are no files to show';
$string['user:view'] = 'View user private files';
$string['privacy:metadata'] = 'The Private files repository plugin does not store or transmit any personal data.';

View File

@ -0,0 +1,46 @@
<?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 Subsystem implementation for repository_webdav.
*
* @package repository_webdav
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace repository_webdav\privacy;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for repository_webdav implementing null_provider.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason() : string {
return 'privacy:metadata';
}
}

View File

@ -37,3 +37,4 @@ $string['webdavbasicauth'] = 'WebDAV basic authentication';
$string['webdavdigestauth'] = 'WebDAV digest authentication';
$string['webdav'] = 'WebDAV';
$string['webdav:view'] = 'View WebDav repository';
$string['privacy:metadata'] = 'The WebDAV repository plugin does not store any personal data, but it is transmitted from Moodle to the remote system.';

View File

@ -0,0 +1,135 @@
<?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 Subsystem implementation for repository_wikimedia.
*
* @package repository_wikimedia
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace repository_wikimedia\privacy;
use core_privacy\local\metadata\collection;
use core_privacy\local\request\approved_contextlist;
use core_privacy\local\request\context;
use core_privacy\local\request\contextlist;
use core_privacy\local\request\writer;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for repository_wikimedia implementing metadata and plugin providers.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @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,
\core_privacy\local\request\user_preference_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 {
$collection->add_external_location_link(
'wikimedia.org',
[
'search_text' => 'privacy:metadata:repository_wikimedia:search_text'
],
'privacy:metadata:repository_wikimedia'
);
$collection->add_user_preference(
'repository_wikimedia_maxwidth',
'privacy:metadata:repository_wikimedia:preference:maxwidth'
);
$collection->add_user_preference(
'repository_wikimedia_maxheight',
'privacy:metadata:repository_wikimedia:preference:maxheight'
);
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(int $userid) : contextlist {
return new 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 data for all users in the specified context.
*
* @param context $context The specific context to delete data for.
*/
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) {
}
/**
* Export all user preferences for the plugin.
*
* @param int $userid The userid of the user whose data is to be exported.
*/
public static function export_user_preferences(int $userid) {
$maxwidth = get_user_preferences('repository_wikimedia_maxwidth', null, $userid);
if ($maxwidth !== null) {
writer::export_user_preference(
'repository_wikimedia',
'repository_wikimedia_maxwidth',
$maxwidth,
get_string('privacy:metadata:repository_wikimedia:preference:maxwidth', 'repository_wikimedia')
);
}
$maxheight = get_user_preferences('repository_wikimedia_maxheight', null, $userid);
if ($maxheight !== null) {
writer::export_user_preference(
'repository_wikimedia',
'repository_wikimedia_maxheight',
$maxheight,
get_string('privacy:metadata:repository_wikimedia:preference:maxheight', 'repository_wikimedia')
);
}
}
}

View File

@ -29,3 +29,7 @@ $string['wikimedia:view'] = 'View wikimedia repository';
$string['configplugin'] = 'Wikimedia repository type configuration';
$string['maxwidth'] = 'Max image width (px)';
$string['maxheight'] = 'Max image height (px)';
$string['privacy:metadata:repository_wikimedia'] = 'The Wikimedia repository plugin does store user preferences, and transmits user data from Moodle to the remote system.';
$string['privacy:metadata:repository_wikimedia:search_text'] = 'The Wikimedia repository user search text query.';
$string['privacy:metadata:repository_wikimedia:preference:maxwidth'] = 'The user preference Max Width configured for the Wikimedia repository.';
$string['privacy:metadata:repository_wikimedia:preference:maxheight'] = 'The user preference Max Height configured for the Wikimedia repository.';

View File

@ -0,0 +1,94 @@
<?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 Subsystem implementation for repository_youtube.
*
* @package repository_youtube
* @copyright 2018 Zig Tan <zig@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace repository_youtube\privacy;
use core_privacy\local\metadata\collection;
use core_privacy\local\request\approved_contextlist;
use core_privacy\local\request\context;
use core_privacy\local\request\contextlist;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for repository_youtube implementing metadata, plugin providers.
*
* @copyright 2018 Zig Tan <zig@moodle.com>
* @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 {
$collection->add_external_location_link(
'youtube.com',
[
'searchtext' => 'privacy:metadata:repository_youtube:searchtext'
],
'privacy:metadata:repository_youtube'
);
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(int $userid) : contextlist {
return new 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 data for all users in the specified context.
*
* @param context $context The specific context to delete data for.
*/
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) {
}
}

View File

@ -35,3 +35,5 @@ $string['sortpublished'] = 'Date Published';
$string['sortrating'] = 'Rating';
$string['sortrelevance'] = 'Relevance';
$string['sortviewcount'] = 'View Count';
$string['privacy:metadata:repository_youtube'] = 'The Youtube videos repository plugin does not store any personal data, but does transmit user data from Moodle to the remote system.';
$string['privacy:metadata:repository_youtube:searchtext'] = 'The Youtube videos repository user search text query.';