1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-23 09:23:09 +02:00

MDL-36369 qtypes and qbehaviour settings permissions.

The correct policy is that users with moodle/question:config can set the
default settings for particular qtypes. However, it requires
moodle/site:config in order to do manage qbehaviours or manage qtypes.
This commit is contained in:
Tim Hunt 2012-11-13 16:07:28 +00:00
parent e75324a53e
commit 837e181225
2 changed files with 7 additions and 5 deletions

@ -5252,7 +5252,7 @@ class admin_page_manageqbehaviours extends admin_externalpage {
public function __construct() {
global $CFG;
parent::__construct('manageqbehaviours', get_string('manageqbehaviours', 'admin'),
new moodle_url('/admin/qbehaviours.php'), 'moodle/question:config');
new moodle_url('/admin/qbehaviours.php'));
}
/**
@ -5299,8 +5299,8 @@ class admin_page_manageqtypes extends admin_externalpage {
*/
public function __construct() {
global $CFG;
parent::__construct('manageqtypes', get_string('manageqtypes', 'admin'), "$CFG->wwwroot/$CFG->admin/qtypes.php",
'moodle/question:config');
parent::__construct('manageqtypes', get_string('manageqtypes', 'admin'),
new moodle_url('/admin/qtypes.php'));
}
/**

@ -2924,9 +2924,11 @@ class plugininfo_qtype extends plugininfo_base {
$section = $this->get_settings_section_name();
$settings = null;
if ($hassiteconfig && file_exists($this->full_path('settings.php'))) {
$systemcontext = context_system::instance();
if (($hassiteconfig || has_capability('moodle/question:config', $systemcontext)) &&
file_exists($this->full_path('settings.php'))) {
$settings = new admin_settingpage($section, $this->displayname,
'moodle/site:config', $this->is_enabled() === false);
'moodle/question:config', $this->is_enabled() === false);
include($this->full_path('settings.php')); // this may also set $settings to null
}
if ($settings) {