It appears that the workflow module's state transitions seem to work fine, including the assignment of actions on selected state transitions (in our case we added the auto-toggling of the (un)publish flag when a new story/page has been reviewed and found fit to go "live").
However the functionality to assign view/edit/delete permissions for existing roles w.r.t. posts in each of the defined workflow states doesn't seem to do anything at all.

Our aim is to have an "authors/editors" role to provide content (while not visible to the public), while the "publisher" role approves the content and promotes it to "live" (ie makes it visible to the public). After publication authors/editors should NOT be able to change content, unless the publisher puts the content/node back in the editable state.
The ADVERTISED functionality of the workflow accesss module would allow us to do just that.

We have used drupal core 6.6/6.7/6.8 together with the latest workflow development release 6.x-1.0-dev (13 Nov 08), rather than the latest official workflow release (6.x-1.0-rc3) because of the bug mentioned in the following issues:
#344264: warning: Missing argument 1 for trigger_access_check();
#343162: Missing argument for trigger_access_check;
#310439: menu_alter discrepancy ("warning: Missing argument 1 for trigger_access_check()").

Anyone know a workaround? Or an ETA for the fix of the workflow module in 6.x?

Comments

RdeBoer’s picture

Priority: Critical » Normal
Palo M.’s picture

I'm interested in having exactly same functionality: once the state is set to final "Released" state, author should be no more allowed to edit/delete the node. I'm using 6.x-1.0-rc3 and it also does not work there :-(

MartinPaulo’s picture

Doesn't work for me, either :-(. I would love to know the ETA for a fix.

james.cartledge’s picture

subscribe

rup3rt’s picture

Priority: Normal » Critical

Escalating to critical.

* workflow_access settings are all OK but actual access is not as expected

* View access is denied to different roles on the same content type even with identical sid,rid and grant_view settings

* node_access permissions all OK

Many thanks!

R3

japanitrat’s picture

this is really critical. I thought it would work after all this configuration hassle, but as we tested today, it simply doesnt do what it should.

Is it working in the latest dev release?

japanitrat’s picture

hmm, so i researched ..

It all comes down to node_access where hook_access is invoked for the content-type's module. If this access callback returns something different than NULL, node_access will exit immediatly without checking grants, which is pretty rude.

We mainly care about editing/deleting nodes that are restricted to do so by a certain user in a certain workflow state, so the op we have to look for is "update" and "delete" in modules that implement hook_access if something doesnt work there. In my case, most of my types are just nodes (with cck) where "node_content_access" is invoked (since the module I use for the node-type is just "node"). Looking into that function (see D6 API) we find that the permissions to "edit any %type", "edit own %type" and "delete any %type", "delete own %type" are queried for a simple node. Just remove these node-permissions from your target roles and workflow will get its chance in node_access, because node_content_access is returning nothing (NULL) when these permissions are not set for the user. Works also for viewing, as long as the status is considered as TRUE ( == 1 is published I believe). Note: You'll always have access if you got "administer nodes" permissions.

Actually I do not know, why node_access returns immediatly when a proper hook_access has been found (and is returning something), makes not really sense to me. I mean, these node grants are meant to give other modules a chance to alter the rights, so maybe both grants should be merged somehow. The way it is now, the node-type's module can explicitely say "stop right here, I give damn about grants". -- so, uhmm .. yeah, its not workflow's fault ;)

jvandyk’s picture

Status: Active » Closed (works as designed)

As japanitrat has noted, Drupal's current behavior is to ask the module that has a hook_access() implementation for the node type whether or not access should be allowed. It is only if the module does not respond that the node_access system in invoked.

This is explained, along with a nice flowchart (IMO the most difficult in the book!) in "The Node Access Process" on page 161 of Pro Drupal Development, Second Edition.

In other words, this is not workflow's fault because it is not even being called by Drupal core.

To see attempts to redo the node access system in Drupal core, see http://drupal.org/node/196922

mitchell’s picture

Content Access now includes actions and conditions for Rules and Workflow-ng. (as of #323985: Rules integration)

Another interesting solution is Node Access User Reference. This module moves access controls into the node form, enabling, for eg, access configurations based on the field's default value(s) using php_snippets or tokens.

MartinPaulo’s picture

Yes, this might not be workflow's fault.

But if I understand the code correctly the core node module will not allow any access hook to be activated when the node is unpublished, because of the check

if ($op != 'create' && $node->nid && $node->status) {
/* handle permissions */
}

in the node_access function, as $node->status flags "published"/"unpublished".

Implying, if I am correct in my understanding, that workflow permissions will apply only for published content?

mitchell’s picture

@MartinPaulo: you'd probably get a better answer if you asked that in the Core issue queue.

MartinPaulo’s picture

But if I am correct, isn't the fact that workflow permissions will apply only to published content a workflow problem rather than a Core issue?

It already feels odd to me that this has been closed with a "by design" status when it seems to me that removing node-permissions from target roles in order to get the workflow permissions to kick in just flies in both face of common sense and practical use.

jvandyk’s picture

As you point out in #10, the core node_access() function is the one responsible for invoking Drupal's secondary node access system, of which workflow_access is a part. And yes, the if statement there does test for the published status of a node.

This issue is marked "by design" not because the current arrangement is the best thing since sliced bread, but because it is "by design of Drupal core" that access is handled this way. In other words, the best place to change this behavior and make it better is in the issue I pointed to in #8 and other related issues, not here in the workflow queue.

mudd’s picture

Does Drupal's permissions model check to see if content/nodes are published before applying access rules? If so, then I don't understand why it should be a criteria that an object is published before applying permissions. I'm having a tough time getting Workflow to work properly, and it seems it's this check that's at fault.

Should this check be removed from 6.x with a patch? What part of the access model is still dependent on having a node published before applying access rules. Might it be best if that dependency (whatever it might be) is addressed so that we can use the permission model on non-published content?

jvandyk’s picture

justinz, you are not the only one to think that. But once again, expressing your opinion of Drupal's permissions model in this issue does not help matters. Rather, read up on the attempts to actually fix this. Some starting points:

http://drupal.org/node/196922
http://drupal.org/node/286692
http://www.google.com/search?hl=en&q=unpublished+permissions+node+access...

mudd’s picture

I'm not experienced at drupal, yet I'm in a crunch to deliver an application in days. I've batted around Books, Workflow, and several other efforts that bill themselves as being frameworks geared toward content moderation, but none are secure in that respect. Referring me to drupal's Seventh major release under development doesn't help much either. I've read hundreds of threads on this subject, and this one being very close to the heart of the matter, and nearly one month since that last post, I felt it might be a good idea to revive this thread in hopes to force progress toward a 6.x patch.

So for now I've chosen to publish everything and hope I don't miss anything of Workflow's extensive settings. This is mostly there, and tho I have to somehow get rid of "Published ..." from view titles, it's nice that a users sees their public and unmoderated nodes in the same views without too much custom view-building.

brian_c’s picture

Yes, nodes MUST be published for Workflow Access permissions to have any effect, this is a limitation of Drupal core, not the Workflow module, as discussed here: Workflow nodes must always be published for access controls to apply.

it seems to me that removing node-permissions from target roles in order to get the workflow permissions to kick in just flies in both face of common sense and practical use

I appreciate the confusion, this tripped me up when I was new to Drupal also. What is important to understand is that Drupal's permission system is ENTIRELY based on "Allow" permissions; there is no such thing as a "Deny" permission.

So if a user has "Edit Own Content" in the global permissions, they will ALWAYS be able to edit their own content. Period. Doesn't matter if another module comes along with more fine-grained control that the user is not granted; they already have the "carte blanche" permission granted at a higher level.

In other words, don't think of blank permission checkboxes as "deny"... they're not. They're simply the absence of "allow". This is a subtle but crucial difference.

What this means in practice, is that higher-level "general" permissions must be removed, if lower-level "granular" permissions are to make any difference.

RdeBoer’s picture

To justinz #14 and #16

It's been a thorn in my eye too justinz...
As it really got in the way of me serving a customer, I had to do something about it (in version 6.x at least).
I've just completed a couple of modules that I'm happy to share with you and the community at large.
Have a read of what is said at the Module Grants and Revisioning module pages.
There's tutorials too.
It may help a little. Hope it's not too late for your customer ...

One description of drupal's somewhat quirky content access control system (which I think you've pretty much figured out yourself) can be found here.

Good luck!

andrewsuth’s picture

@RdeBoer

I am glad someone had the know-how and time to program this module and share it with the community. For me, the power of the Workflow module would be wasted and rendered almost useless without your Grants module contribution.

I've installed it in order for moderators to access unpublished nodes in my worklflow and it works a treat with just one permission change.

Well done and thanks!