Extending Drupal 7 Block Permissions

4th September 2011 | Tags:

Dru­pal 7’s block mod­ule can be a lit­tle lim­ited in its per­mis­sions; “Admin­is­ter Blocks” is a rather sweep­ing capa­bil­ity, and often it’s use­ful to be able to make it that bit more gran­u­lar. For exam­ple, you may have a num­ber of blocks through­out the site but once they have been placed in the cor­rect region and the vis­i­bil­ity cor­rectly con­fig­ured (which often isn’t the sim­plest of processes), you don’t want con­tent man­agers to change those set­tings. You do, how­ever, need to allow them to change the title as it appears to site vis­i­tors, and of course the con­tent. This isn’t pos­si­ble out-​of-​the-​box; luck­ily, it’s not that hard to do. Inspired by kiamlaluno’s post on Dru­pal Answers along these lines, I’ve knocked up a sim­ple mod­ule to make per­mis­sions gran­u­lar enough for just a sit­u­a­tion. It’s incred­i­bly sim­ple and some­what lim­ited, but it does enable to you to grant or deny access to each part of a block’s con­fig­u­ra­tion, i.e.:

  • the title as it appears to users
  • the descrip­tion as it appears in the back-​end
  • block con­tent
  • the regions the block is assigned to
  • vis­i­bil­ity settings

I’ve put the code on Github for now; down­load, install & enable, then you’ll find five new per­mis­sions under block\_extended\_permissions. Hope you find it useful.

Comments

No comments yet.

Links and images are allowed, but please note that rel="nofollow" will be automactically appended to any links.