mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 14:03:52 +01:00
Merge branch 'MDL-73414' of https://github.com/paulholden/moodle
This commit is contained in:
commit
7146bd1dfa
@ -9831,33 +9831,8 @@ class admin_setting_enablemobileservice extends admin_setting_configcheckbox {
|
||||
|
||||
// Allow rest:use capability for authenticated user.
|
||||
$this->set_protocol_cap(true);
|
||||
|
||||
} else {
|
||||
//disable web service system if no other services are enabled
|
||||
$otherenabledservices = $DB->get_records_select('external_services',
|
||||
'enabled = :enabled AND (shortname != :shortname OR shortname IS NULL)', array('enabled' => 1,
|
||||
'shortname' => MOODLE_OFFICIAL_MOBILE_SERVICE));
|
||||
if (empty($otherenabledservices)) {
|
||||
set_config('enablewebservices', false);
|
||||
|
||||
// Also disable REST server.
|
||||
$activeprotocols = empty($CFG->webserviceprotocols) ? array() : explode(',', $CFG->webserviceprotocols);
|
||||
|
||||
$protocolkey = array_search('rest', $activeprotocols);
|
||||
if ($protocolkey !== false) {
|
||||
unset($activeprotocols[$protocolkey]);
|
||||
$updateprotocol = true;
|
||||
}
|
||||
|
||||
if ($updateprotocol) {
|
||||
set_config('webserviceprotocols', implode(',', $activeprotocols));
|
||||
}
|
||||
|
||||
// Disallow rest:use capability for authenticated user.
|
||||
$this->set_protocol_cap(false);
|
||||
}
|
||||
|
||||
//disable the mobile service
|
||||
// Disable the mobile service.
|
||||
$mobileservice = $webservicemanager->get_external_service_by_shortname(MOODLE_OFFICIAL_MOBILE_SERVICE);
|
||||
$mobileservice->enabled = 0;
|
||||
$webservicemanager->update_external_service($mobileservice);
|
||||
|
Loading…
x
Reference in New Issue
Block a user