mirror of
https://github.com/moodle/moodle.git
synced 2025-03-22 08:30:04 +01:00
MDL-61920 ltiservice_gradebookservices: implement privacy provider
This commit is contained in:
parent
af099b484c
commit
2b3c4538f1
@ -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 ltiservice_gradebookservices.
|
||||
*
|
||||
* @package ltiservice_gradebookservices
|
||||
* @copyright 2018 Mark Nelson <markn@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace ltiservice_gradebookservices\privacy;
|
||||
|
||||
use \core_privacy\local\metadata\collection;
|
||||
use \core_privacy\local\request\contextlist;
|
||||
use \core_privacy\local\request\approved_contextlist;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Privacy Subsystem for ltiservice_gradebookservices.
|
||||
*
|
||||
* @copyright 2018 Mark Nelson <markn@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->link_external_location('External LTI provider.', [
|
||||
'userid' => 'privacy:metadata:userid',
|
||||
'grade' => 'privacy:metadata:grade',
|
||||
'maxgrade' => 'privacy:metadata:maxgrade',
|
||||
'feedback' => 'privacy:metadata:feedback',
|
||||
'timemodified' => 'privacy:metadata:timemodified'
|
||||
], '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 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 user data which matches the specified context.
|
||||
*
|
||||
* @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) {
|
||||
}
|
||||
}
|
@ -34,5 +34,11 @@ $string['modulename'] = 'LTI Grades';
|
||||
$string['nevergs'] = 'Do not use this service';
|
||||
$string['partialgs'] = 'Use this service for grade sync only';
|
||||
$string['pluginname'] = 'LTI Assignment and Grade Services';
|
||||
$string['privacy:metadata:externalpurpose'] = 'This information is sent to an external LTI provider.';
|
||||
$string['privacy:metadata:feedback'] = 'The feedback the user received for this LTI activity.';
|
||||
$string['privacy:metadata:grade'] = 'The grade the user received in Moodle for this LTI activity.';
|
||||
$string['privacy:metadata:maxgrade'] = 'The max grade that can be achieved for this LTI activity.';
|
||||
$string['privacy:metadata:timemodified'] = 'The last time the grade was updated';
|
||||
$string['privacy:metadata:userid'] = 'The ID of the user using the LTI consumer.';
|
||||
$string['servicename'] = 'LTI Assignment and Grade Services';
|
||||
$string['taskcleanup'] = 'LTI Assignment and Grade Services table cleanup';
|
||||
|
@ -0,0 +1,51 @@
|
||||
<?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 ltiservice_gradebookservices privacy provider.
|
||||
*
|
||||
* @package ltiservice_gradebookservices
|
||||
* @copyright 2018 Mark Nelson <markn@moodle.com>
|
||||
* @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 ltiservice_gradebookservices privacy provider.
|
||||
*
|
||||
* @copyright 2018 Mark Nelson <markn@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class ltiservice_gradebookservices_privacy_provider_testcase extends provider_testcase {
|
||||
|
||||
/**
|
||||
* Basic setup for these tests.
|
||||
*/
|
||||
public function setUp() {
|
||||
$this->resetAfterTest(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 = \ltiservice_gradebookservices\privacy\provider::get_contexts_for_userid($user->id);
|
||||
$this->assertEmpty($contextlist);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user