mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
MDL-61198 course: New function for format to support external config
New function to return the course format settings for external clients via Web Services. Some settings (like private keys/tokens) should be not returned if the user hasn’t appropriate permissions.
This commit is contained in:
parent
39fab18e27
commit
ef184ad6e0
@ -1261,6 +1261,17 @@ abstract class format_base {
|
||||
|
||||
return ['modules' => $modules];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the plugin config settings for external functions,
|
||||
* in some cases the configs will need formatting or be returned only if the current user has some capabilities enabled.
|
||||
*
|
||||
* @return array the list of configs
|
||||
* @since Moodle 3.5
|
||||
*/
|
||||
public function get_config_for_external() {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -478,4 +478,14 @@ class format_singleactivity extends format_base {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the plugin configs for external functions.
|
||||
*
|
||||
* @return array the list of configuration settings
|
||||
* @since Moodle 3.5
|
||||
*/
|
||||
public function get_config_for_external() {
|
||||
// Return everything (nothing to hide).
|
||||
return $this->get_format_options();
|
||||
}
|
||||
}
|
||||
|
@ -120,4 +120,15 @@ class format_social extends format_base {
|
||||
public function allow_stealth_module_visibility($cm, $section) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the plugin configs for external functions.
|
||||
*
|
||||
* @return array the list of configuration settings
|
||||
* @since Moodle 3.5
|
||||
*/
|
||||
public function get_config_for_external() {
|
||||
// Return everything (nothing to hide).
|
||||
return $this->get_format_options();
|
||||
}
|
||||
}
|
||||
|
@ -399,6 +399,17 @@ class format_topics extends format_base {
|
||||
$rv['section_availability'] = $renderer->section_availability($this->get_section($section));
|
||||
return $rv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the plugin configs for external functions.
|
||||
*
|
||||
* @return array the list of configuration settings
|
||||
* @since Moodle 3.5
|
||||
*/
|
||||
public function get_config_for_external() {
|
||||
// Return everything (nothing to hide).
|
||||
return $this->get_format_options();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2,6 +2,12 @@ This files describes API changes for course formats
|
||||
|
||||
Overview of this plugin type at http://docs.moodle.org/dev/Course_formats
|
||||
|
||||
=== 3.5 ===
|
||||
* Course formats should overwrite get_config_for_external function to return the course format settings viewable by the
|
||||
current user.
|
||||
If the course format does not have any setting that could be considerated private (like a private/access key/token),
|
||||
is ok to return all the settigns via the get_format_options function.
|
||||
|
||||
=== 3.3 ===
|
||||
* Javascript code for editing activities and sections was moved to an AMD module, course/rest.php is no longer
|
||||
responsible for editing actions, instead it is done in web services. Carefully test all editing actions during upgrade.
|
||||
|
@ -565,6 +565,17 @@ class format_weeks extends format_base {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the plugin configs for external functions.
|
||||
*
|
||||
* @return array the list of configuration settings
|
||||
* @since Moodle 3.5
|
||||
*/
|
||||
public function get_config_for_external() {
|
||||
// Return everything (nothing to hide).
|
||||
return $this->get_format_options();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user