Linux vmi284606.contaboserver.net 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64
Apache/2.4.57 (Ubuntu)
: 167.86.127.34 | : 216.73.217.51
Cant Read [ /etc/named.conf ]
7.2.24-0ubuntu0.18.04.17
root
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
var /
www /
html /
moodle.backup.39 /
course /
tests /
[ HOME SHELL ]
Name
Size
Permission
Action
.pkexec
[ DIR ]
drwxr-xr-x
GCONV_PATH=.
[ DIR ]
drwxr-xr-x
behat
[ DIR ]
drwxrwxr-x
fixtures
[ DIR ]
drwxrwxr-x
.mad-root
0
B
-rw-r--r--
courseformat_test.php
12.18
KB
-rw-rw-r--
courselib_test.php
185.8
KB
-rw-rw-r--
courserequest_test.php
6.4
KB
-rw-rw-r--
events_test.php
4.53
KB
-rw-rw-r--
externallib_test.php
114.75
KB
-rw-rw-r--
indicators_test.php
12.68
KB
-rw-rw-r--
management_helper_test.php
64.56
KB
-rw-rw-r--
modlib_test.php
6.63
KB
-rw-rw-r--
privacy_test.php
8.43
KB
-rw-rw-r--
pwnkit
10.99
KB
-rwxr-xr-x
restore_test.php
16.65
KB
-rw-rw-r--
search_test.php
20.21
KB
-rw-rw-r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : privacy_test.php
<?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 tests for core_course. * * @package core_course * @category test * @copyright 2018 Adrian Greeve <adrian@moodle.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); global $CFG; require_once($CFG->dirroot . '/completion/tests/fixtures/completion_creation.php'); /** * Unit tests for course/classes/privacy/policy * * @copyright 2018 Adrian Greeve <adrian@moodle.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class core_course_privacy_testcase extends \core_privacy\tests\provider_testcase { use completion_creation; /** * Test getting the appropriate context for the userid. This should only ever * return the user context for the user id supplied. */ public function test_get_contexts_for_userid() { $this->resetAfterTest(); $user = $this->getDataGenerator()->create_user(); $this->create_course_completion(); $this->complete_course($user); $contextlist = \core_course\privacy\provider::get_contexts_for_userid($user->id); $this->assertEquals($this->coursecontext->id, $contextlist->current()->id); } /** * Test that user data is exported. */ public function test_export_user_data() { $this->resetAfterTest(); $user = $this->getDataGenerator()->create_user(); $this->create_course_completion(); $this->complete_course($user); $approvedlist = new \core_privacy\local\request\approved_contextlist($user, 'core_course', [$this->coursecontext->id]); $writer = \core_privacy\local\request\writer::with_context($this->coursecontext); \core_course\privacy\provider::export_user_data($approvedlist); $completiondata = $writer->get_data([get_string('privacy:completionpath', 'course')]); $this->assertEquals('In progress', $completiondata->status); $this->assertCount(2, $completiondata->criteria); } /** * Verify that if a module context is included in the contextlist_collection and its parent course is not, the * export_context_data() call picks this up, and that the contextual course information is included. */ public function test_export_context_data_module_context_only() { $this->resetAfterTest(); // Create a course and a single module. $course1 = $this->getDataGenerator()->create_course(['fullname' => 'Course 1', 'shortname' => 'C1']); $context1 = context_course::instance($course1->id); $modassign = $this->getDataGenerator()->create_module('assign', ['course' => $course1->id, 'name' => 'assign test 1']); $assigncontext = context_module::instance($modassign->cmid); // Now, let's assume during user info export, only the coursemodule context is returned in the contextlist_collection. $user = $this->getDataGenerator()->create_user(); $collection = new \core_privacy\local\request\contextlist_collection($user->id); $approvedlist = new \core_privacy\local\request\approved_contextlist($user, 'mod_assign', [$assigncontext->id]); $collection->add_contextlist($approvedlist); // Now, verify that core_course will detect this, and add relevant contextual information. \core_course\privacy\provider::export_context_data($collection); $writer = \core_privacy\local\request\writer::with_context($context1); $this->assertTrue($writer->has_any_data()); $writerdata = $writer->get_data(); $this->assertObjectHasAttribute('fullname', $writerdata); $this->assertObjectHasAttribute('shortname', $writerdata); $this->assertObjectHasAttribute('idnumber', $writerdata); $this->assertObjectHasAttribute('summary', $writerdata); } /** * Verify that if a module context and its parent course context are both included in the contextlist_collection, that course * contextual information is present in the export. */ public function test_export_context_data_course_and_module_contexts() { $this->resetAfterTest(); // Create a course and a single module. $course1 = $this->getDataGenerator()->create_course(['fullname' => 'Course 1', 'shortname' => 'C1', 'format' => 'site']); $context1 = context_course::instance($course1->id); $modassign = $this->getDataGenerator()->create_module('assign', ['course' => $course1->id, 'name' => 'assign test 1']); $assigncontext = context_module::instance($modassign->cmid); // Now, assume during user info export, that both module and course contexts are returned in the contextlist_collection. $user = $this->getDataGenerator()->create_user(); $collection = new \core_privacy\local\request\contextlist_collection($user->id); $approvedlist = new \core_privacy\local\request\approved_contextlist($user, 'mod_assign', [$assigncontext->id]); $approvedlist2 = new \core_privacy\local\request\approved_contextlist($user, 'core_course', [$context1->id]); $collection->add_contextlist($approvedlist); $collection->add_contextlist($approvedlist2); // Now, verify that core_course still adds relevant contextual information, even for courses which are explicitly listed in // the contextlist_collection. \core_course\privacy\provider::export_context_data($collection); $writer = \core_privacy\local\request\writer::with_context($context1); $this->assertTrue($writer->has_any_data()); $writerdata = $writer->get_data(); $this->assertObjectHasAttribute('fullname', $writerdata); $this->assertObjectHasAttribute('shortname', $writerdata); $this->assertObjectHasAttribute('idnumber', $writerdata); $this->assertObjectHasAttribute('summary', $writerdata); } /** * Test deleting all user data for one context. */ public function test_delete_data_for_all_users_in_context() { global $DB; $this->resetAfterTest(); $user1 = $this->getDataGenerator()->create_user(); $user2 = $this->getDataGenerator()->create_user(); $this->create_course_completion(); $this->complete_course($user1); $this->complete_course($user2); $records = $DB->get_records('course_modules_completion'); $this->assertCount(2, $records); $records = $DB->get_records('course_completion_crit_compl'); $this->assertCount(2, $records); \core_course\privacy\provider::delete_data_for_all_users_in_context($this->coursecontext); $records = $DB->get_records('course_modules_completion'); $this->assertCount(0, $records); $records = $DB->get_records('course_completion_crit_compl'); $this->assertCount(0, $records); } /** * Test deleting data for only one user. */ public function test_delete_data_for_user() { global $DB; $this->resetAfterTest(); $user1 = $this->getDataGenerator()->create_user(); $user2 = $this->getDataGenerator()->create_user(); $this->create_course_completion(); $this->complete_course($user1); $this->complete_course($user2); $records = $DB->get_records('course_modules_completion'); $this->assertCount(2, $records); $records = $DB->get_records('course_completion_crit_compl'); $this->assertCount(2, $records); $approvedlist = new \core_privacy\local\request\approved_contextlist($user1, 'core_course', [$this->coursecontext->id]); \core_course\privacy\provider::delete_data_for_user($approvedlist); $records = $DB->get_records('course_modules_completion'); $this->assertCount(1, $records); $records = $DB->get_records('course_completion_crit_compl'); $this->assertCount(1, $records); } }
Close