Allow resources to skip the per-entity access check
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3302145. --> Reported by: [ptmkenny](https://www.drupal.org/user/97885) Related to !33 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>I created a custom resource that returns the results of an entity query that is restricted to the logged-in user's content. Since users have permission to view all their own content, I tried to disable the access check in the resource to speed up performance.</p> <p>When I did that, I got the following error:</p> <blockquote><p>It is not yet allowed to create entity-oriented resources that do not check entity access. If this is a requirement for your project, please open a feature request in the issue queue: <a href="https://www.drupal.org/project/issues/jsonapi_resources">https://www.drupal.org/project/issues/jsonapi_resources</a></p></blockquote> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <p>Disable the access check in a custom resource:</p> <pre>&nbsp;&nbsp;&nbsp; $data = $this-&gt;loadResourceObjectDataFromEntityQuery($entity_query, $cacheability, false, false);</pre><h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Add support for disabling the access check.</p> <p>Alternately, if disabling the access check has a minimal impact on performance, adding an explanation to that effect in the documentation would be better.</p> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <h3 id="summary-ui-changes">User interface changes</h3> <h3 id="summary-api-changes">API changes</h3> <h3 id="summary-data-model-changes">Data model changes</h3>
issue