mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-55791 admin: maintenance mode access capability
Add capability to allow certain non-admin users through maintenance mode.
This commit is contained in:
parent
0344082208
commit
59c66f926f
7 changed files with 22 additions and 13 deletions
|
@ -120,9 +120,9 @@ class webservice {
|
|||
}
|
||||
}
|
||||
|
||||
//Non admin can not authenticate if maintenance mode
|
||||
$hassiteconfig = has_capability('moodle/site:config', context_system::instance(), $user);
|
||||
if (!empty($CFG->maintenance_enabled) and !$hassiteconfig) {
|
||||
// Cannot authenticate unless maintenance access is granted.
|
||||
$hasmaintenanceaccess = has_capability('moodle/site:maintenanceaccess', context_system::instance(), $user);
|
||||
if (!empty($CFG->maintenance_enabled) and !$hasmaintenanceaccess) {
|
||||
//this is usually temporary, client want to implement code logic => moodle_exception
|
||||
throw new moodle_exception('sitemaintenance', 'admin');
|
||||
}
|
||||
|
@ -924,9 +924,9 @@ abstract class webservice_server implements webservice_server_interface {
|
|||
$user = $this->authenticate_by_token(EXTERNAL_TOKEN_EMBEDDED);
|
||||
}
|
||||
|
||||
//Non admin can not authenticate if maintenance mode
|
||||
$hassiteconfig = has_capability('moodle/site:config', context_system::instance(), $user);
|
||||
if (!empty($CFG->maintenance_enabled) and !$hassiteconfig) {
|
||||
// Cannot authenticate unless maintenance access is granted.
|
||||
$hasmaintenanceaccess = has_capability('moodle/site:maintenanceaccess', context_system::instance(), $user);
|
||||
if (!empty($CFG->maintenance_enabled) and !$hasmaintenanceaccess) {
|
||||
throw new moodle_exception('sitemaintenance', 'admin');
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue