MDL-87545 tool_mobile: expose enablemyhome via webservices

This commit is contained in:
Andi Permana
2026-02-27 21:20:11 +07:00
parent b2186b51b0
commit cf7edef142
4 changed files with 8 additions and 0 deletions
+1
View File
@@ -379,6 +379,7 @@ class api {
}
if (empty($section) || $section === 'navigation') {
$settings->enablemyhome = $CFG->enablemyhome ?? 1;
$settings->enabledashboard = $CFG->enabledashboard;
}
@@ -242,6 +242,7 @@ final class externallib_test extends \core_external\tests\externallib_testcase {
$expected[] = ['name' => 'coursegraceperiodafter', 'value' => $CFG->coursegraceperiodafter];
$expected[] = ['name' => 'coursegraceperiodbefore', 'value' => $CFG->coursegraceperiodbefore];
$expected[] = ['name' => 'enablemyhome', 'value' => $CFG->enablemyhome ?? 1];
$expected[] = ['name' => 'enabledashboard', 'value' => $CFG->enabledashboard];
$expected[] = ['name' => 'customusermenuitems', 'value' => $CFG->customusermenuitems];
$expected[] = ['name' => 'timezone', 'value' => $CFG->timezone];
+5
View File
@@ -144,6 +144,11 @@ class core_course_external extends external_api {
//retrieve the course
$course = $DB->get_record('course', array('id' => $params['courseid']), '*', MUST_EXIST);
// Accessing the site home via the web service is not allowed when it is disabled.
if ($course->id == SITEID && empty($CFG->enablemyhome)) {
throw new moodle_exception('error:sitehomeisdisabled', 'course');
}
// now security checks
$context = context_course::instance($course->id, IGNORE_MISSING);
try {
+1
View File
@@ -95,6 +95,7 @@ $string['downloadcontent_help'] = 'Should this activity or resource be included
The setting has no effect on mobile app content download for offline usage.';
$string['enabledownloadcoursecontent'] = 'Enable download course content';
$string['error:sitehomeisdisabled'] = 'The Site Home has been disabled by an administrator.';
$string['errorendbeforestart'] = 'The end date ({$a}) is before the course start date.';
$string['favourite'] = 'Starred course';
$string['filterbothactive'] = 'First ({$a->first}) Last ({$a->last})';