Closed (fixed)
Project:
Block Class
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
5 Feb 2011 at 18:33 UTC
Updated:
3 Oct 2012 at 22:17 UTC
Jump to comment: Most recent file
Currently the module doesn't check for permission in hook_form_alter(), it does only in the submit callback, that is IMO a bad practice: if the user doesn't have the permission to administer blocks or block classes, she should not see this option at all.
I would suggest to add a separate permission called administer block access and in hook_form_alter() check if the user has administer block access or administer blocks permission.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | block_class-1052240-10.patch | 974 bytes | sgabe |
| #5 | block_class.1052240_03.patch | 883 bytes | sgabe |
| #2 | block_class.1052240_02.patch | 1.13 KB | sgabe |
| #1 | block_class.1052240_01.patch | 1.13 KB | sgabe |
Comments
Comment #1
sgabe commentedSee the attached patch.
Comment #2
sgabe commentedPlease ignore the first patch.
Comment #3
todd nienkerk commentedThis module shouldn't check for the "administer blocks" permission in
hook_form_alter()because the user can't access the blocks configuration interface at all without "administer blocks" permission. It's a moot point.I'm not entirely convinced we need a separate permission to add block classes. It seems to me that if a user can be trusted to move blocks around the page, alter their content, and change its visibility -- especially using PHP -- they can certainly be trusted to add something as benign as CSS classes. We need a clear use case for a granular permission before we can introduce one.
It's also worth noting that adding a new permission to Block Class will cause problem for users upgrading to the new release. They'll need to know to enable the permission on their site; otherwise, that form element will not appear, and the module will appear to be broken. Most users do not read release notes, so they probably won't know about this change. The benefit of adding a new permission will need to outweigh this confusion (and the resulting posts to the issue queue about how the the form element suddenly "disappeared).
Can you provide a clear use case for a user who can be trusted to fully administer blocks but not add CSS classes to them?
Comment #4
sgabe commentedGosh...Well, that's right. Sorry, I didn't sleep yesterday at all.
However I would still suggest to add a new permission for this module. I would like to use the Block Access module, so I don't need to grant administer blocks permission to the user. I can set permissions for individual blocks. I want the user to see only the Block specific settings (description, title, body) and nothing else. Currently the Block class option is always visible irrespectively of the permission set.
The solution would be to do this in Block Class by adding a new permission and/or adding support for this module in Block Access. I think it would be the right choice if the users of this module would be able to limit access for the block class by default, without installing another module. (Block Access can still provide support, but that is another issue.)
IMO the block class is about themeing and the user should not be able to change it because she can change other options (site builder vs. themer settings) like who can see the block or what is in the body of the block!
Comment #5
sgabe commentedAttaching actually working patch.
Comment #6
berenddeboer commentedPatch committed.
Comment #7
sgabe commentedLet me reassign this to myself so I can track my issues. Please don't forget to give attribution for contributors, see Adding a commit author and Commit messages - providing history and credit for more information.
Comment #8
berenddeboer commentedYou're right. Tried to amend commit, merge tree looks really weird now.
Comment #10
sgabe commentedThis needs to be ported to D7.
Comment #11
berenddeboer commentedCommitted.