Allow admins to bypass access check

Created on 8 April 2020, over 4 years ago
Updated 4 September 2023, over 1 year ago

Problem/Motivation

The module doesn't skip access checking when grabbing IDs of entities to delete. If run from the command line this means only entities that anonymous users have view access to get deleted.

Steps to reproduce

(This is just one example of triggering the issue.)

  1. Enable the View Unpublished module. (See here for details why.)
  2. Create an unpublished article node owned by an authenticated user. (And ensure anonymous users don't have permission to view unpublished content or bypass permissions, etc.)
  3. Run drush dade --type=node --bundle=article.
  4. The unpublished node still exists.

Proposed resolution

Add a bypass-access-check option to skip access checking.
Please note that we won't bypass access check by default as we have a UI for this module's functionality and we'd want to check access there.

Remaining tasks

Original report by MilosR

Hello everyone.

I'm using this module for a while and now I try to delete the large amount type of entities. Some of the entities deleted well but some of them do not delete at all and just say "[notice] Message: Deleted 0 entities." but I have a lot of entities. So I created a patch to fix this issue.

Drupal 8

🐛 Bug report
Status

Needs review

Version

3.0

Component

Code

Created by

🇭🇷Croatia milosr Croatia, Montenegro

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024