Dear all,
I have encountered the following problem:
Presets:
- Content Type Creation exposed to Anonymous
- One Workflow, attached to Post "Workflow 1"
- One Workflow setup: author & anonymous can move Workflow from (creation) to "Pending"(custom state)
- Permissions: Not Checked (Deny) for Anonymous: Participate in workflow, Show workflow state change on node view, Schedule workflow transitions,Administer workflow
- Structure -> Content Type -> Manage Display -> Workflow: State Change Form set to Hidden
Expected result:
- Workflow State change form is not shown to any user
Actual result:
- Tab "Workflow 1" appears for every user.
Thank you for any help or pointers.
Best.
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | 1971504.patch | 2.03 KB | nancydru |
Comments
Comment #1
nhck commentedIn workflow/workflow.module in function workflow_form_alter(&$form, &$form_state, $form_id) it says, in line 623
Since this isn't user sensitive it will aways expose the form. I am not sure if it is really a bug. It is more an unexpected behavior - since the role Anonymous is not allowed to participate in workflow.
Comment #2
nancydru"Participate in Workflow" is only a way to simplify the settings form. It is not a "real" permission.
The setting, "Workflow tab permissions," for the workflow should be controlling this form. Check at admin/config/workflow/workflow/edit/xxx (where xxx is the workflow id)
Comment #3
nhck commentedNancy, thank you for getting back to me.
The permissions you mention are set correctly. Anonymous still sees this when the node creation form is exposed to Anon. This is because workflow_form_alter() does not use the permission check.
I don't have an insight if that would be code duplication, but maybe it is possible to change that line (workflow.module:625) to:
Comment #4
nancydruI'm assuming that you have "Display workflow on" with "Post" checked and are seeing this during editing.
First, I can't imagine the utility of that, but the feature was there before I came here. In my installation, the people who enter or edit content are not the people who advance it through the workflow.
I tried to set up a test according to what you say above. Without the Tab Form permissions set in the workflow, the anonymous user did not see the state change form during edit, even with the "Show workflow state change on node view " permission. They could see the Workflow tab (next to Edit), but all that was there was the history.
When I allowed anonymous users to transition to another state as well as the first one, then the form showed up. I would expect this, because it was told to let anonymous users do that transition.
If I disallow anonymous users to make the first transition [i.e. "(creation)" to "New"] then the form shows up as well. I have to think about this for a while. Even though the user is anonymous, the node has to go to the first state. Note that "author" still refers to an anonymous user creating content.
Comment #5
nancydruI cannot convince myself that the module is doing anything wrong.
Comment #6
nhck commentedThank you for your time Nancy. I'll try and answer.
>I'm assuming that you have "Display workflow on" with "Post" checked and are seeing this during >editing.
That is correct.
>First, I can't imagine the utility of that, but the feature was there before I came here.
That quite simple tp explain: I have a field on that page which I expose to a higher level user. This user will fill that field (a review text for the node) and progress it through the workflow accordingly. Its just more comfortable to have it on one page.
>I tried to set up a test according to what you say above. Without the Tab Form permissions set in >the workflow, the anonymous user did not see the state change form during edit, even with the >"Show workflow state change on node view " permission. They could see the Workflow tab (next to >Edit), but all that was there was the history.
Just to clarify this: I am talking about the Vertical Tab on the bottom of the creation page. Additionally the node creation must be exposed to Anonymous.
>When I allowed anonymous users to transition to another state as well as the first one, then the >form showed up. I would expect this, because it was told to let anonymous users do that transition.
Actually if this node wants to participate in the workflow you must allow a transition from (creation) to a state - otherwise there is this error:
This does not mean I want Anonymous to see the form. Which is additionally a bit pointless b/c they cannot do anything. The next state is fixed preselected.
>Even though the user is anonymous, the node has to go to the first state. Note that "author" still >refers to an anonymous user creating content.
Right - and I think thats the problem here. Why can't it just stay at "creation"?
Comment #7
bradallenfisher commentedJust create a bogus state and be done with it. :)
Comment #8
nhck commentedRight, but it still shows the form - which is confusing to Anon.
Comment #9
nancydruI found this confusing at first as well. The "(creation)" state is an internal designation that a node has not yet completed saving. It MUST transition into a real state upon saving. That's why "author" must be allowed to transition the node to a state, usually the first state.
Again, the "Participate in Workflow" permission has nothing to do with node workflow. It is used only to indicate which user roles will show up in the workflow transitions admin page. This was added for people who had a large number of roles that had nothing to do with workflow; it only makes that form simpler. Perhaps it should be named something different.
Comment #10
nhck commentedThank you again Nancy, for trying to understand my issue.
Honestly, I don't find it confusing at all, neither the creation state nor that the author has to be assigned the right to transit the node.
What I do find I confusing that this also must expose this transition change to the UI. Anon cannot change the state to anything different in my case. Anon is not allowed to see the tab (Workflow tab permissions). Yet it is exposed as a vertical in the creation ui. I find this mind boggling.
Comment #11
nancydruI just created a node as an anonymous user. The "author" had transition rights to only go from the "(creation)" state to the "New" state. I did not see the workflow vertical tab. If I allow "author" to move to other states as well, then the tab will show up, exactly as I would expect.
Are you saying that you see a different behavior? Are you using the latest -dev release?
Comment #12
nhck commentedNancy - thank you for bearing with me here.
Yes I am seeing a different behavior.
It is the same in my case: The author has transition rights to only go from the "(creation)" state to the "New"(in my case its called "Pending") state.
I do see the vertical tab in any case. Since the author is only permitted to transit from "(creation)" to "Pending" this state is pre-selected and a radio button, so you cannot deselect it. The whole vertical tab does not go away unless I apply the change from #3.
And this makes perfect sense b/c the form "is factored out of workflow_form_alter()" as stated in the source code. There is no access check as far as I can tell in workflow_form_alter().
(This also causes weirdness if you set the the workflow fieldset to hidden in admin/structure/types/manage/*/display - nothing happens.)
Comment #13
nancydruI am not seeing behavior that is other than what I think it should be - and I have done quite a bit of testing. Keep in mind that this is with the dev code, not the official release. My inclination is close this as "Works as designed". But I will give people two weeks to argue with me.
Comment #14
nhck commentedSeeing a different behaviour from #4 even with the current dev code.
I created a simplytest to show this
http://se18a9fe9ba8b9ca.s3.simplytest.me/
..but it will probably long gone before anyone sees this. It however verified that there is no interaction with other modules I have installed.
Just to summarize, to check we are on the same train:
If the above is correct, how do you recommend we set up a test case around this to help you solve this?
Comment #15
nancydruI have set up three different test systems and tried every configuration I can think of. It just doesn't do that for me.
I really want to get a 7.x-1.2 release done, but I don't want this issue to remain.
Comment #16
nhck commentedOkay. my try this is what I do on simplytest.me:
Comment #17
nancydruAccording to your description "Author" has "From → (creation) To STATE A", so he indeed has permission. However, I agree that it shouldn't be there because there is only one state change available and it must occur. And, in my test system, it does not show, but I also don't enable all those sub-modules. Please disable Workflow Access and let's see if the issue is there.
Comment #18
nancydruTry this
Comment #19
nancydruforgot status
Comment #20
nhck commentedThank you Nancy, of course that patch does the trick.
Even though I still find it confusing that the "Workflow tab permissions" don't include the vertical tab I will give it a rest.
Again: Thank you for working on this and sorry for delaying your new version.
Best,
nhck
PS: Did you know dreditor comes with a simplytest.me button? So awesome!
Comment #21
nancydruOriginally the vertical tab didn't exist, so I guess that was never considered. "Workflow Tab" is considered the tab that goes up there with "View" and "Edit."
Comment #22
nancydruCommitted
Comment #24
kcannick commentedI Believe I am having a similar issue with version 2.x using workflow node. I have "expose workflow form on node" permission enable for authenticated. Giving Author permission to transition between states exposes workflow form on all nodes in selected states, even those that the user is not the author of. I can't imagine this is intended. Does workflow form not check for user's permission by node or am i missing something?
Comment #25
nancydruYou need to open this as a new issue against 7.x-2.x and reference this one.