Problem/Motivation
I have a very specific jsonapi request that is failing unless I grant the user the "Administer vocabularies and terms" permission.
Steps to reproduce
I have a content type that has taxonomy fields and I'm querying that content type using jsonapi requests.
This filter works without the permission:
[country] => Array
(
[condition] => Array
(
[path] => field_political_district_set.field_country
[operator] => =
[value] = CA
)
)
But this filter does not work unless I grant the permission:
[org-group] => Array
(
[group] => Array
(
[conjunction] => OR
)
)
[field_base_id] => Array
(
[condition] => Array
(
[path] => field_political_district_set.field_organization.field_base_id
[value] => 1
[memberOf] => org-group
)
)
[country] => Array
(
[condition] => Array
(
[path] => field_political_district_set.field_country
[operator] => =
[value] => CA
[memberOf] => org-group
)
)
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Issue fork drupal-3272235
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
Comment #2
bbralaAny chance you could dump the query? It might be an acces check hardening bug see: #3072384: When filtering by entity relationships in an "OR" group, if one of the relationship fields is empty, the item is improperly excluded from the data which sometimes breaks "OR" queries.
Comment #3
lambic commentedAh yeah that sounds like what might be happening. How would I dump the query?
Comment #7
quietone commented@lambic, is this still a problem? If you resolved it can add a comment on what you did. Thanks.
This looks like it needs a reply to #3. Setting back to NR for an answer.
@josmera01, Credit has been removed per How is credit granted for Drupal core issues.
Comment #8
smustgrave commentedClosing this one out
@lambic to dump your query can use something like this
If it's a view you can go to /admin/structure/views/settings and enable Show SQL Query. Then in the View UI you'll see the query.
Third option is to see if the devel module can be used.
Thought think option1 is probably the best from what it sounds like.
If turns out different from #3072384: When filtering by entity relationships in an "OR" group, if one of the relationship fields is empty, the item is improperly excluded from the data please reopen with an explanation how it was different
Thanks!