In workbench_access_user_load_data() on line 823, there is currently a conditional that doesn't logically make sense, and breaks all of the role-based access settings. The conditional checks to see if there are user-based access settings, and if there are, it overwrites them with role-based access settings. If there are no user-based access settings, then the loop does nothing, and the existent role-based access settings are not applied. This means that role-based access settings never work and are never applied correctly.
This patch reverses the conditional so that if there are user-based access settings, the loop does NOT overwrite them with role based settings, but if there are no user-based settings and there ARE role-based settings, the role settings are added.
| Comment | File | Size | Author |
|---|---|---|---|
| #32 | 2547039-role-usage-patch-32.patch | 7.38 KB | agentrickard |
| #28 | Screen Shot 2015-10-01 at 1.48.39 PM.png | 55.13 KB | agentrickard |
| #28 | 2547039-role-usage-patch-28.patch | 7.15 KB | agentrickard |
| #24 | 2547039-role-usage-patch-23.patch | 6.98 KB | agentrickard |
| #22 | 2547039-role-usage-patch-failing-test.patch | 3.08 KB | agentrickard |
Comments
Comment #2
pcoffey commentedComment #3
katannshaw commentedI experienced some strange behavior from 7.x-1.3 and reverted back to 7.x-1.2. I tried your patch and it failed for me with this output:
--- Failed ---
sites\all\modules\workbench_access\workbench_access.module (Cannot apply hunk @@ 8 )
@pcoffey: Did you experience this sort of thing?
Create content = limited # of groups shown
Edit content = message displayed "Page 1 is assigned to the Administration editorial group(s), which may not be changed."
Comment #4
matt.elkins commentedI upgraded from 7.x-1.2+10-dev to 7.x-1.3 and, without modifying the existing Workbench Access configuration, user roles that originally had access to certain content types were being denied access to the corresponding node forms. I can confirm the patch in #1 fixes this issue for me!
Comment #5
katannshaw commentedSo it appears that the behavior I experienced is unrelated to this issue.
I'll open a separate issue report.I've found a related issue report. Thanks for the clarification @matt.elkins.Comment #6
sgdev commentedAdding other posted issues related to this patch.
Comment #7
nmillin commentedPatch fixes my issues.
Comment #8
svenaas commentedThe patch resolved an issue I was having: users with the role Administrator were given workbench access to all taxonomy terms via the root of the tree, and the 7.x-1.3 update broke this access. The patch restores the expected behavior. Thank you!
Comment #9
tkngdwn commentedI can confirm patch in #1 works as well.
Comment #10
fredcy commentedThe patch works for me too. The problem was preventing many (all?) non-admin users from editing content. I hope a new release goes out soon with this patch in it.
Comment #11
sgdev commentedWhile this patch "fixes the problem," all it really does is roll back a previous patch that was included in 7.x-1.3: https://www.drupal.org/node/1959590
The issue identified in #1959590 needs to be solved to truly fix this.
Comment #12
kwfinken commentedComment #13
kaptenkolja commentedI can confirm patch in #1 works.
Comment #14
agentrickardWhat this needs are tests.
Comment #15
kaptenkolja commentedHow can I help?
What I experienced on upgrade to version 1.3 of the module for a site running workbench access with a taxonomy based access tree was that:
- the users that had role based access settings no longer had any access.
- the users with access assigned to their respective account/user kept theirs.
On running the patch, the per role based access settings were restored.
I have not studied the code in play though.
Comment #16
agentrickardWell, the issue is that this got in to 7.x.1.3 because none of the existing tests failed. So first we need a failing test -- without this patch -- and then we can prove that this patch fixes the problem.
Comment #17
agentrickardHere's the root problem that needs to be addressed first:
Nothing in workbench_access.test checks the role assignment handing. We test workbench_access_user_section_save() and workbench_access_user_section_delete() but not the role-based equivalents.
That's why all current tests passed (and still do).
Comment #18
agentrickardOK. I understand the issue now. Here's a patch that adds some clarity to the sections form by noting which sections are by user and which are by role.
This still needs tests, but should be fine for production.
Comment #22
agentrickardTestbot seems to be having trouble, but here's a test that fails and proves that the bug is accurate.
Comment #24
agentrickardAnd here's both patches combined. This has a working test case:
* Check that user with no sections cannot edit.
* Assign user to a section by role.
* User can edit
* Remove that section from the role.
* User cannot edit.
Comment #28
agentrickardAdded another UI tweak to disable the user edit form for items assigned by role.
The tests pass, but testbot is not behaving.
Once we have confirmation that this patch is working for people, I can roll a new release.
Comment #32
agentrickardMinor UI tweak, but still the same patch.
Anyone care to review? Lack of reviews caused the bad 1.3 release.
Comment #34
kaptenkolja commentedI would like to test your patch, but I can't get it to apply. I could supply the output from my terminal but I'm not sure if this is the place for that?
Comment #35
mxwright commented@agentrickard The patch in #32 didn't apply cleanly, but it DID appear to solve this issue.
Comment #36
pcoffey commented@agentrickard I am down to review this.
Comment #37
agentrickardThis patch would be applied to the -dev release.
Comment #40
mxwright commented@agentrickard Patch works for me and applies clean to 7.x-1.x-dev
Comment #42
agentrickardI think between that review, the new tests, and the initial reports on this patch, we can commit this.
Comment #44
agentrickard