As I'm somehow new to drupal and not 100% sure if I'm doing the right thing please be indulgent. I wrote a patch to enable access control on selfmade blocks for menu.module.

Till now it was possible to set blocks to certain pages but not depending on user roles. With this patch you will have an entry for each selfmade block under "access control -> menu modul", each starting with "show".

CommentFileSizeAuthor
menu.module_1.patch957 bytesRalf Ollig

Comments

Bèr Kessels’s picture

In the blocks admin you can add PHP. So you can set this there too. I dislike the idea of making an exeptional rule for navigation block.
Also, your spaces in the code ar esomewhat strange. PLease use two spaces for identation

Ralf Ollig’s picture

In the blocks admin you can add PHP. So you can set this there too.

But I have to do it for each and every block, this isn't quite useable. I'm working on a project with 10 differnt userroles, and each role must to be able to have it's on blocks. It's more flexible to add it once instead of adding it for every block, right?

I dislike the idea of making an exeptional rule for navigation block.

This is done before in the menu.module, I didn't understood it too.

Sorry, diff screwd up the indentation.

rrichard63’s picture

After installing this patch, I got several instances of the following error message: "Cannot modify header information - headers already sent by (output started at /home/.../modules/menu.module:542) in /home/.../includes/common.inc on line 192."

followed by one instance of: "call_user_func_array(): First argumented is expected to be a valid callback, 'block_admin' was given in /home/.../includes/menu.inc on line 354"

Needless to say, I uninstalled the patch. I do, however, desperately need this feature. There are several other patches offered in previous forum posts. I guess I'll try those.

It seems to me that enough folks have asked for this (and some have attempted to do it themselves) that it is time to do it right, test it thoroughly, and make it official. Thanks in advance.

--Bob Richard

moshe weitzman’s picture

Status: Needs review » Needs work

this shoudl be handled on the block admin page with a checkbox for each role. lets not clutter the permissions page with this info. also, i'd rather not see special case code for user.module.

Ralf Ollig’s picture

this shoudl be handled on the block admin page with a checkbox for each role.lets not clutter the permissions page with this info

I guess this can be discussed, I think it's quite hard to set permissons on different sites for every feature. One central approach within the permisson page would be great but maybe with different "areas" or "subcategories/menus".
If there would be checkboxes it would clutter this page to, think of maybe 10 different user roles. A "multi select" box imho fits this need better.

i'd rather not see special case code for user.module.

You're right there shouldn't be special cases.

chx’s picture

Status: Needs work » Fixed

Features do not go against 4.6 and in 4.7 you can code bloack visiblity w/ PHP.

Anonymous’s picture

Status: Fixed » Closed (fixed)