Skip to content

Commit

Permalink
Merge branch 'MDL-80724-master' of https://github.com/jleyva/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
HuongNV13 committed Feb 13, 2024
2 parents 043c829 + 94bc97a commit b32407f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions webservice/externallib.php
Expand Up @@ -172,6 +172,12 @@ public static function get_site_info($serviceshortnames = array()) {
'name' => 'mnet_dispatcher_mode',
'value' => ($CFG->mnet_dispatcher_mode == 'strict') ? 1 : 0
);
// Competencies.
$enablecompetencies = get_config('core_competency', 'enabled');
$siteinfo['advancedfeatures'][] = [
'name' => 'enablecompetencies',
'value' => (!empty($enablecompetencies)) ? 1 : 0,
];

// User can manage own files.
$siteinfo['usercanmanageownfiles'] = has_capability('moodle/user:manageownfiles', $context);
Expand Down
4 changes: 4 additions & 0 deletions webservice/tests/externallib_test.php
Expand Up @@ -111,13 +111,17 @@ public function test_get_site_info() {
$this->assertEquals(1, $siteinfo['downloadfiles']);
$this->assertEquals(1, $siteinfo['uploadfiles']);

$this->assertCount(12, $siteinfo['advancedfeatures']);
foreach ($siteinfo['advancedfeatures'] as $feature) {
if ($feature['name'] == 'mnet_dispatcher_mode') {
if ($CFG->mnet_dispatcher_mode == 'off') {
$this->assertEquals(0, $feature['value']);
} else {
$this->assertEquals(1, $feature['value']);
}
} else if ($feature['name'] == 'enablecompetencies') {
$expected = (!empty(get_config('core_competency', 'enabled'))) ? 1 : 0;
$this->assertEquals($expected, $feature['value']);
} else {
$this->assertEquals($CFG->{$feature['name']}, $feature['value']);
}
Expand Down

0 comments on commit b32407f

Please sign in to comment.