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.

Comments

pcoffey created an issue. See original summary.

pcoffey’s picture

Status: Patch (to be ported) » Needs review
katannshaw’s picture

I 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."

matt.elkins’s picture

Status: Needs review » Reviewed & tested by the community

I 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!

katannshaw’s picture

So 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.

sgdev’s picture

nmillin’s picture

Patch fixes my issues.

svenaas’s picture

The 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!

tkngdwn’s picture

I can confirm patch in #1 works as well.

fredcy’s picture

The 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.

sgdev’s picture

While 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.

kwfinken’s picture

kaptenkolja’s picture

I can confirm patch in #1 works.

agentrickard’s picture

Status: Reviewed & tested by the community » Needs work

What this needs are tests.

kaptenkolja’s picture

How 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.

agentrickard’s picture

Well, 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.

agentrickard’s picture

StatusFileSize
new39.01 KB

Here'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).

agentrickard’s picture

Status: Needs work » Needs review
StatusFileSize
new3.46 KB

OK. 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.

Status: Needs review » Needs work

The last submitted patch, 18: 2547039-role-usage-patch-18.patch, failed testing.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 18: 2547039-role-usage-patch-18.patch, failed testing.

agentrickard’s picture

Status: Needs work » Needs review
StatusFileSize
new3.08 KB

Testbot seems to be having trouble, but here's a test that fails and proves that the bug is accurate.

Status: Needs review » Needs work

The last submitted patch, 22: 2547039-role-usage-patch-failing-test.patch, failed testing.

agentrickard’s picture

Status: Needs work » Needs review
StatusFileSize
new6.98 KB

And 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.

Status: Needs review » Needs work

The last submitted patch, 24: 2547039-role-usage-patch-23.patch, failed testing.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 24: 2547039-role-usage-patch-23.patch, failed testing.

agentrickard’s picture

Status: Needs work » Needs review
StatusFileSize
new7.15 KB
new55.13 KB

Added 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.

Status: Needs review » Needs work

The last submitted patch, 28: 2547039-role-usage-patch-28.patch, failed testing.

The last submitted patch, 28: 2547039-role-usage-patch-28.patch, failed testing.

agentrickard’s picture

Status: Needs work » Needs review
StatusFileSize
new7.38 KB

Minor UI tweak, but still the same patch.

Anyone care to review? Lack of reviews caused the bad 1.3 release.

Status: Needs review » Needs work

The last submitted patch, 32: 2547039-role-usage-patch-32.patch, failed testing.

kaptenkolja’s picture

I 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?

mxwright’s picture

@agentrickard The patch in #32 didn't apply cleanly, but it DID appear to solve this issue.

patching file tests/workbench_access.test
patching file workbench_access.admin.inc
Hunk #2 FAILED at 426.
1 out of 3 hunks FAILED -- saving rejects to file workbench_access.admin.inc.rej
patching file workbench_access.module
Hunk #1 succeeded at 821 (offset 3 lines).
pcoffey’s picture

@agentrickard I am down to review this.

agentrickard’s picture

This patch would be applied to the -dev release.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 32: 2547039-role-usage-patch-32.patch, failed testing.

mxwright’s picture

Version: 7.x-1.3 » 7.x-1.x-dev

@agentrickard Patch works for me and applies clean to 7.x-1.x-dev

Status: Needs work » Needs review
agentrickard’s picture

I think between that review, the new tests, and the initial reports on this patch, we can commit this.

  • agentrickard committed a0fa346 on 7.x-1.x
    Bug #2547039 by pcoffey, mxwright, svenaas, et.al. Fixes bad logic in...
agentrickard’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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