MDL-87545 tool_mobile: expose enablemyhome via webservices
This commit is contained in:
@@ -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];
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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})';
|
||||
|
||||
Reference in New Issue
Block a user