MDL-55791 admin: maintenance mode access capability

Add capability to allow certain non-admin users through maintenance
mode.
This commit is contained in:
Matt Davidson 2016-09-12 10:37:25 -04:00
parent 0344082208
commit 59c66f926f
7 changed files with 22 additions and 13 deletions

View file

@ -2292,5 +2292,11 @@ $capabilities = array(
'manager' => CAP_ALLOW
),
),
'moodle/site:maintenanceaccess' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => array(
)
),
);

View file

@ -2683,7 +2683,7 @@ function require_login($courseorid = null, $autologinguest = true, $cm = null, $
}
// If the site is currently under maintenance, then print a message.
if (!empty($CFG->maintenance_enabled) and !has_capability('moodle/site:config', $sysctx)) {
if (!empty($CFG->maintenance_enabled) and !has_capability('moodle/site:maintenanceaccess', $sysctx)) {
if ($preventredirect) {
throw new require_login_exception('Maintenance in progress');
}