Problem/Motivation
Having the following error after finishing the installation.
Error message
Entity queries must explicitly set whether the query should be access checked or not. See Drupal\Core\Entity\Query\QueryInterface::accessCheck().
Proposed resolution
Have queries over entities changed in the DRD Agent module
With basic accessCheck(FALSE) or pass the needed access check for admins or selected user roles and permissions.
Access checking must be explicitly specified on content entity queries
#2785449: It's too easy to write entity queries with access checks that must not have themBEFORE
// This gets all articles the current user can view. $ids = \Drupal::entityQuery('node') ->condition('type', 'article') ->execute(); // This also gets all articles the current user can view. $ids = \Drupal::entityQuery('node') ->accessCheck(TRUE) ->condition('type', 'article') ->execute(); // This gets all articles that exist regardless of access. $ids = \Drupal::entityQuery('node') ->accessCheck(FALSE) ->condition('type', 'article') ->execute();AFTER
// This will trigger a deprecation error. $ids = \Drupal::entityQuery('node') ->condition('type', 'article') ->execute(); // Unchanged: This gets all articles the current user can view. $ids = \Drupal::entityQuery('node') ->accessCheck(TRUE) ->condition('type', 'article') ->execute(); // Unchanged: This gets all articles that exist regardless of access. $ids = \Drupal::entityQuery('node') ->accessCheck(FALSE) ->condition('type', 'article') ->execute();
Remaining tasks
- File an issue
- Patch/MR
- Test
- Review
User interface changes
- N/A
API changes
- N/A
Data model changes
- N/A
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | 3348413-10.patch | 442 bytes | generalredneck |
| #2 | 3348413-2.patch | 778 bytes | rajab natshah |
Issue fork drd_agent-3348413
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
rajab natshahComment #4
rajab natshahComment #5
rajab natshahComment #6
jurgenhaasThis is great, thanks @Rajab Natshah for finding and fixing this.
Comment #8
jurgenhaasComment #9
generalredneck@jurgenhass @Rajab Natshan,
This fix causes a fatal
The addition of accesscheck was too liberal. accesscheck doesn't exist on a this->database->select() query.
This can be reproduced by adding a new core in a drd dashboard and authorizing the remote. Afterward this manifests on the dashboard as "Remote instance does not support DRD."
Comment #10
generalredneckCouldn't figure out how to add a second MR to this Issue through the existing issue fork... So here's a patch.
Comment #12
jurgenhaasMerged patch from #10