Skip to content

Commit

Permalink
Issue #3136762 by dww, codersukanta, webchick, larowlan: Update.php i…
Browse files Browse the repository at this point in the history
…ncludes link to 'Put site into maintenance mode' for users without permission to use it

(cherry picked from commit 4833c49b0cd7c94ab59a4d741eed5732987515e5)
  • Loading branch information
alexpott committed Aug 4, 2020
1 parent 569133e commit 65038fa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion modules/system/system.routing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ system.site_maintenance_mode:
_form: '\Drupal\system\Form\SiteMaintenanceModeForm'
_title: 'Maintenance mode'
requirements:
_permission: 'administer site configuration'
_permission: 'administer site configuration+administer software updates'

system.run_cron:
path: '/admin/reports/status/run-cron'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -659,17 +659,26 @@ public function testSuccessfulMultilingualUpdateFunctionality() {
* Tests maintenance mode link on update.php.
*/
public function testMaintenanceModeLink() {
$admin_user = $this->drupalCreateUser([
$full_admin_user = $this->drupalCreateUser([
'administer software updates',
'access administration pages',
'administer site configuration',
]);
$this->drupalLogin($admin_user);
$this->drupalLogin($full_admin_user);
$this->drupalGet($this->updateUrl, ['external' => TRUE]);
$this->assertSession()->statusCodeEquals(200);
$this->clickLink('maintenance mode');
$this->assertSession()->statusCodeEquals(200);
$this->assertSession()->elementContains('css', 'main h1', 'Maintenance mode');

// Now login as a user with only 'administer software updates' (but not
// 'administer site configuration') permission and try again.
$this->drupalLogin($this->updateUser);
$this->drupalGet($this->updateUrl, ['external' => TRUE]);
$this->assertSession()->statusCodeEquals(200);
$this->clickLink('maintenance mode');
$this->assertSession()->statusCodeEquals(200);
$this->assertEquals('Maintenance mode', $this->cssSelect('main h1')[0]->getText());
$this->assertSession()->elementContains('css', 'main h1', 'Maintenance mode');
}

/**
Expand Down

0 comments on commit 65038fa

Please sign in to comment.