Block should only be injected if the current user has permission to view the block.

Comments

fonant’s picture

Status: Active » Needs review
StatusFileSize
new1.8 KB

OK, patch that works for me attached.

The new code queries the blocks_roles table to see if there are per-role access restrictions on the block, and if there are for the current user then it doesn't render the block.

The query is similar to the query in block_list() in blocks.module, but without checking that the block is enabled (as blocks to be injected into menus may not be enabled anywhere else, and the menu item is explicitly asking for them anyway).

fonant’s picture

Title: Block injection ignores role specific visibility settings » Block injection ignores role-specific visibility settings
petermallett’s picture

I wasn't sure how to get this patch to apply, so I remade it by hand with git with a few minor tweaks, posting here for documentation and committing on the 6.x-1.x branch

  • Commit 7344c3b on 6.x-1.x authored by fonant, committed by petermallett:
    Issue #2018923 by fonant: Fix Block injection ignores role-specific...
petermallett’s picture

Version: 6.x-1.2 » 7.x-1.x-dev
Status: Needs review » Needs work

Committed to the 6.x-1.x branch, updating the issue and moving back to Needs work as this issue is present for D7 as well

petermallett’s picture

Status: Needs work » Needs review
StatusFileSize
new2.8 KB

Implemented a role-based visibility check in the d7 branch.