Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

Is there a module (or other way) to give permission to non-admin-users to put the site offline (and only that permission)?

share|improve this question
    
Which version of Drupal are you using? –  Krishna Mohan Sep 1 at 14:42
    
It's under '/admin' so they'd need the "access administration pages" permission straight off I think –  Clive Sep 1 at 14:43
    
You can the site status programmatically To put the site offline For D7 variable_set("maintenance_mode",1); To put the site online For D7 variable_set("maintenance_mode",1); For D6 it is variable_set('site_offline', '0'); –  Krishna Mohan Sep 1 at 15:01

3 Answers 3

up vote 6 down vote accepted

There is a module for that!

Maintenance Mode Permissions

Placing a site in or removing it from maintenance mode is allowed under a permission that has wide spread administrative access (administer site configuration). Sometimes you'd like to give permission to put the site in maintenance mode to someone but not give them complete access. This modules enables this case.

share|improve this answer

On D6 and D7, there's no specific permission to give to a role to grant access to the Maintenance mode page (admin/config/development/maintenance). This is because it has the "Administer site configuration" that grants access to many other configs that important and should be restricted only to a few users/role.

You can use Drush to do it:

drush vset maintenance_mode 1

Or create a new permission for that path (admin/config/development/maintenance) with hook_alter_menu:

function {your module}_alter_menu(&$items) {
  // Site maintenance
  $items['admin/settings/site-maintenance']['access arguments'] = array('administer maintenance mode');
}

To create the new permission use hook_permission:

function {your module}_permission() {
  return array(
    'administer maintenance mode' => array(
      'title' => t('Administer maintenance mode'),
      'description' => t('Perform administration on maintenance mode page.'),
  )
}
share|improve this answer

You would need to give the permission "System > Administer site configuration". You can give that permission basically to whatever role you like. This lets users with that role put your site into Maintenance Mode. But be aware that this is a very powerful permission and it comes along with other administrative rights. Also – if you give that permission to a role you should probably also give the permission to view the site, if it's in Maintenance Mode.

I would consider such practice actually a security risk and would recommend to only give that permission to an extra role like "co-admin" or the like.

Edit: there's a module that let's you split administrative permissions into smaller chunks called Custom Permissions. The project page also gives a good impression which administrative rights are connected to the permision "System > Administer site configuration".

"By default the following permissions are created:"

administer administration theme
administer clean-urls
administer date-time
administer error reporting
administer file system
administer modules
administer performance
administer site information
administer site maintenance
display site building menu
display site configuration menu
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.