Admin: Add plugin_settings config to disable BBB settings

And use them in priority

See BT#18666
pull/3859/head
Julio Montoya 5 years ago
parent 118e10c515
commit cb5789fc65
  1. 33
      main/inc/lib/plugin.class.php
  2. 9
      main/install/configuration.dist.php

@ -199,7 +199,6 @@ class Plugin
public function getSettingsForm()
{
$result = new FormValidator($this->get_name());
$defaults = [];
$checkboxGroup = [];
$checkboxCollection = [];
@ -213,6 +212,8 @@ class Plugin
}
}
$disableSettings = $this->disableSettings();
foreach ($this->fields as $name => $type) {
$options = null;
if (is_array($type) && isset($type['type']) && $type['type'] === 'select') {
@ -226,6 +227,12 @@ class Plugin
$type = $type['type'];
}
if (!empty($disableSettings)) {
if (in_array($name, $disableSettings)) {
continue;
}
}
$value = $this->get($name);
$defaults[$name] = $value;
$type = isset($type) ? $type : 'text';
@ -336,6 +343,16 @@ class Plugin
*/
public function get($name)
{
$settings = api_get_configuration_value('plugin_settings');
if (!empty($settings) && isset($settings[$this->get_name()])) {
$prioritySettings = $settings[$this->get_name()];
if (!empty($prioritySettings)) {
if (isset($prioritySettings[$name])) {
return $prioritySettings[$name];
}
}
}
$settings = $this->get_settings();
foreach ($settings as $setting) {
if ($setting['variable'] == $this->get_name().'_'.$name) {
@ -1040,6 +1057,20 @@ class Plugin
{
}
/**
* Disable the settings configured in configuration.php ($configuration[plugin_settings])
*/
public function disableSettings()
{
$settings = api_get_configuration_value('plugin_settings');
if (!empty($settings) && isset($settings[$this->get_name()])) {
return array_keys($settings[$this->get_name()]);
}
return [];
}
/**
* Add an link for a course tool.
*

@ -1853,6 +1853,15 @@ ALTER TABLE gradebook_comment ADD CONSTRAINT FK_C3B70763AD3ED51C FOREIGN KEY (gr
// Show exercise report from all courses in a new page: exercise/pending.php
//$_configuration['my_courses_show_pending_exercise_attempts'] = true;
// Disables the following BBB plugin settings in the plugin form and use them in priority.
/*$_configuration['plugin_settings'] = [
'bbb' => [
'tool_enable' => 'true', // string value
'host' => 'https://www.example.com',
'salt' => 'abc123'
]
];*/
// KEEP THIS AT THE END
// -------- Custom DB changes
// Add user activation by confirmation email

Loading…
Cancel
Save