I'm working on a project that requires different workflow permissions for each content types.
For example, we have these roles "article editor", "page editor", "article approver", "page approver", with the actual internal working of WBM (Workbench Moderation), if we have the transition permission from "Draft to Publish" and give it to a "page approver", he will also be able to publish article, which isn't what we want.
One possible solution would be to add the ability to create multiple workflows to WBM (with corresponding permissions), and link each workflows to a Content Type (see related issue).
But this solution is quite complexe and would require many code changes.
As of now I do not need multiple workflows (for my project) as all the content types have the same workflow.
So another solution would be to simply duplicate all the transition permissions for each content types (which is quite simple).
I worked on this solution and found that changing only 3 lines makes it work (it will probably need more, like configuration to enable/disable it for those who doesn't want it, as it creates a lot more permissions).
But I'm here to open a discussion, to know if one of these solutions could/will be implemented in the project and what do you think about it ? (I will may be post the patch for the seconde solution in the next week).
Comment | File | Size | Author |
---|---|---|---|
#3 | 2771355-2.patch | 3.4 KB | jmarcou |
Comments
Comment #2
jmarcou CreditAttribution: jmarcou commentedTests will fail, as they need to be updated for this solution.
Comment #3
jmarcou CreditAttribution: jmarcou commentedComment #4
scookie CreditAttribution: scookie at Workday, Inc. commentedOur organization DOES need different workflows for different content types. Our solution is to create different sets of states for the various workflows, then only enable the appropriate states for each content type. Using your example above:
Here are the states – State label with machine name in parentheses:
Draft (draft_article)
Draft (draft_page)
Published (published_article)
Published (published_page)
Here are the transitions (machine names are in parentheses):
Publish (publish_article): Move from Draft (draft_article) to Published (published_article)
Publish (publish_page): Move from Draft (draft_page) to Published (published_page)
For content type Page, only Draft (draft_page) and Published (published_page) states are enabled.
For content type Article, only Draft (draft_article) and Published (published_article) states are enabled.
Permissions:
Role: article approver – only has permission for the Publish (publish_article) transition
Role: page approver – only has permission for the Publish (publish_page) transition
Comment #5
jmarcou CreditAttribution: jmarcou commentedThat is a solution, but in our case, we have about 30 content types (all with the same workflow), 5 states and 9 transitions, which would result in more than 150 states and 270 transitions. So by just applying my patch, you can automatically apply all your workflow to all content types (considering that all your content types have the same workflow), instead of having to do it manually.
My patch would probably benefit to have a "checkbox option" to enable or disable the "Per content type" workflow, for those who prefer to define their workflows themselves (if the workflows are different, for example).
Comment #6
naveenvalechapatches are tested against dev branch
Comment #7
fawwad.nirvana CreditAttribution: fawwad.nirvana commentedI am using drupal 8.2.5 with workbench moderation 8.x-1.2
i used #3 but there is no check box for content type or no label in permission tab.
Comment #8
ion.macaria CreditAttribution: ion.macaria as a volunteer and commentedFor me patch is working, thank you @jmarcou.
Comment #9
ion.macaria CreditAttribution: ion.macaria as a volunteer and commentedComment #10
ion.macaria CreditAttribution: ion.macaria as a volunteer and commented