Problem/Motivation

When no role has the use workbench access permission, UserSectionStorage::getPotentialEditors() throws an InvalidQueryException:

Query condition 'user__roles.roles_target_id IN ()' cannot be empty.

Steps to reproduce

  1. Install workbench_access.
  2. Create an access scheme.
  3. Go to /admin/config/workflow/workbench_access/test/sections and click on one of the 0 editors links.

Proposed resolution

The condition should not be created if $rids is empty.

Remaining tasks

I will submit a patch.

CommentFileSizeAuthor
#7 3207618-wa-no-roles_7.patch659 bytesagentrickard
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

prudloff created an issue. See original summary.

prudloff’s picture

Status: Active » Needs review
agentrickard’s picture

Status: Needs review » Postponed (maintainer needs more info)

Given that administrators (including user 1) always have all permissions, how are you triggering this error?

And why do the tests fail?

prudloff’s picture

We don't have an administrator role. It is not strictly necessary to have one because UID 1 (even without any role) always passes most permission checks (a least until #540008: Add a container parameter that can remove the special behavior of UID#1 is merged).
So in our case user_role_names(FALSE, 'use workbench access') returns an empty array.

As for the test failure, it does not seem to be related to my change:

Unavailable module: 'inline_entity_form'. If this module needs to be downloaded separately, annotate the test class with '@requires module inline_entity_form'.

agentrickard’s picture

Status: Postponed (maintainer needs more info) » Needs review

Thanks!

agentrickard’s picture

StatusFileSize
new659 bytes

I wonder if that's an issue with the testbot and forks, since our normal tests work fine with a patch workflow.

agentrickard’s picture

Status: Needs review » Reviewed & tested by the community

Odd. I had reported and fixed that once before. #3155657: Test dependencies no longer loaded?.

Perhaps this issue fork doesn't include that change.

  • agentrickard committed 636b2ac on 8.x-1.x authored by prudloff
    Issue #3207618 by prudloff, agentrickard: InvalidQueryException when no...
agentrickard’s picture

Status: Reviewed & tested by the community » Fixed

Committed.

Status: Fixed » Closed (fixed)

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