I ran into an issue when implementing the content publish module on a site running workflow, workflow access, and module grants. The issue seems to be caused by the permissions being implemented with a access callback in the hook_menu_alter. Changing it to a hook_access call allows publish content to play nicely workflow access and based on my limited testing it didn't break any of its existing functionality. Can someone test and confirm the attached patch?

The exact scenario I was having issues with are as follows:
1. Create a content type 'event'
2. Create a content type 'video'
3. Enable the following modules: workflow, workflow access, module grants, publish content
4. Create a role 'event publisher', 'event author', and 'video admin'
5. Create an event workflow according to http://drupal.org/node/408052
6. When setting up the workflow, make sure 'event publisher' and 'event author' can view events in draft state
7. Grant 'publish video content' and 'publish own video content' to role 'video admin'
8. Login with an 'event author' user and create an event
9. Logout and login with an 'event publisher' user
10. Try and view the node you just created
11. Apply patch and it should now let you view the node in draft state

If you have trouble recreating the issue or if you have any trouble with the patch please let me know and I'll take a look at it.

Comments

malaussene’s picture

Assigned: Unassigned » malaussene

Thanks beday00,
could you test the slightly modified patch on your setup.
you will need to run update.php or rebuild the menu.

malaussene’s picture

StatusFileSize
new817 bytes

... and the missing patch

mfer’s picture

This issue affects a lot of modules... for example OG. Does the patch work?

d.clarke’s picture

Status: Needs review » Reviewed & tested by the community

I just tested the patch that malaussene posted in comment #2 and it resolved the issue for me.

aaronbauman’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new1.15 KB

I agree that the hook_menu_alter should be removed. This module should not grant view access to a node that a user with publish/unpublish permissions should not otherwise view.

If an administrator wishes to expose unpublished nodes to users without "administer nodes" permission, they should do so through other means, e.g. a view which shows unpublished nodes.

But why do we need function publishcontent_access at all?
hook_access governs permissions on node types declared by the module, but this module doesn't define any node types, hence publishcontent_access will never get called.

Please review my attached proposed patch.

aaronbauman’s picture

Status: Needs review » Fixed

This is in DEV - will roll a new release soon.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.