2

How can I restrict the Access to the blocks in my website depending on the roles? I.e only a particular role can see (edit view delete configure) a particular block and nobody else can do so.

I tried the Block Access module but to no avail.

Is there any other module that can help?

1

This patch could help you in controlling access to blocks.

Patch is here https://drupal.org/node/1916028#comment-7302100.

Need to apply this patch on dev version of this module 7.x-1.x-dev of Block Access

1

Using the Bean module you can perfectly implement what you're asking for. Here is a quote about its project page:

Think of a Bean as a method to provide new types (compared to node this would be a content type) which then provides an add content interface to create as many blocks as you require. The bean content can then be placed around the site just like any other block.

Combined with the options available for granting the appropriate Bean permissions, it should give you a lot of flexibility about how exactly you want to use this (great) module in your specific case: for each Block type created with the BEAN module, you can use the typical Permissions page (at admin/people/permissions) to grant Add/Edit/View/Delete access to selected roles. So if you'd create one such "block type" for each of the roles you have, then all users with that role (and only those) could then edit view delete configure such blocks (which may be either just 1 block or multiple blocks).

Some more background info about BEANs:

  • To define a Block type you use the admin UI (via admin/structure/block-types), which is similar to defining content types (via admin/structure/types).
  • The difference is that you don't create nodes (of a selected "content type", and by using node/add), but blocks instead (of a selected "block type", and by using block/add).

This module also works great in combination with the UUID and UUID Features Integration modules. And after you become familiar with the Bean module, you might find other cases in your site where you also want to use this module (which somehow compensates the fact that you need to add another module).

The video tutorial Drupal Bean module tutorial - using Bean Admin UI provides a great introduction to really understand the power of this module, and the kind of things you can do with it (by only using site building techniques, no custom coding involved). It also shows how the Bean module transforms Drupal blocks into fieldable entities.

PS: this is a D7 module, integrated in core in D8 ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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