One issue that I've come across is the lack of ability to define permissions at a state level. Namely, it would be nice to control what roles can edit the content at a given state. There is an issue similar to this already:
http://drupal.org/node/1219988
One simple approach that comes to mind would be to add additional permissions to check under workbench moderation. So either before or after the "Moderate all content from..." permissions, we could have "Edit all content in [state]" permissions. My only concern with this approach would be the potential permission sprawl if there are too many states.
I'll play around with this and see if I can get a patch together that demonstrates the concept.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 1296216-5_set_permissions_by_state.patch | 1.54 KB | Bevan |
| #1 | set-permissions-by-state_1296216.patch | 1.68 KB | reujwils |
Comments
Comment #1
reujwils commentedHere is a first crack at adding the permissions described above. Let me know if there is anything missing from this.
Thanks!
Comment #2
stevectorHi reujwils,
I see the problem you are trying to solve. There a lot of similar use cases that could be solved by add more permissions based on content type, state, etc. However we are trying to avoid making changes that will explode the number of permissions this module generates.
I recommend looking at the work muriqui is doing/discussing here: #1108502: Allow modules to alter the list of possible next states
The Conditional Roles module he is writing might be going after the same use case. http://drupal.org/project/conditional_roles
If you need this functionality immediately for a project, I recommend putting the approach used in your patch into a custom module.
Comment #3
reujwils commentedYeah, that does look like some interesting work he is doing over there.
I am working on this for a project atm, so I thought I'd mention it and see what you all think. Thanks for the input, and I'll just include this as part of the code in my module.
Thanks for the feedback.
Comment #4
stevectorComment #5
Bevan commentedThis version of the patch from #1 has the same logic but has style and documentation enhancements. It might be useful for anyone reviewing the patch and wanting to use it while things like conditional roles and access control kit are still maturing.
Comment #6
tregismoreira commentedPatch #5 works sweetly.
The Workbench State Access module seems to try to solve the same problem, but it implements a hook_menu_alter() with a custom access callback, instead of implements hook_node_access() (like this patch) which seems to be more appropriate in this case.
It would be great to have a release with this patch applied.
Comment #7
tregismoreira commentedAny news about this patch? It would be great to have it in a release.
Comment #8
stefan.r commented@tregismoreira the maintainer of the module explained in #2 why this is unlikely to go into Workbench Access.
This patch will probably have to be turned into a contrib module, or get accepted into the Workbench State Access module instead.
Comment #9
stefan.r commentedComment #12
tregismoreira commentedOK, here's the contrib module based on @Bevan's patch: https://www.drupal.org/project/workbench_moderation_state_access.
Comment #13
Mhammad Attar commentedI added a sandbox module that add permissions by @content_type in @state in all operations(View|Edit|Delete)
https://www.drupal.org/sandbox/mhammadattar/2789129