Delete files as an admin not working

Created on 22 August 2023, over 1 year ago
Updated 5 February 2024, 10 months ago

Problem/Motivation

Trying to delete files as an admin by using /admin/config/content/fancy_file_delete/list results in
>
Access denied: Only the file owner can update or delete the file entity. (7)
0 files cleansed.
<

Steps to reproduce

Adding content as a content-editor,
adding a file to that content via file-upload and saving it.
Logout as a content-editor.
Logging in as admin,
navigate to /admin/config/content/fancy_file_delete/list,
checking the checkbox of the file to be deleted,
choosing 'Delete Files' from the Action dropdown and
clicking the button 'Apply to the selected elements' and again on 'Apply action' displays
Warning
Access denied: Only the file owner can update or delete the file entity. (1)
Status
0 files cleansed.

I am using druapl 9.5.10, PHP 8.0, all modules up to date. VBO is installed and activated.

๐Ÿ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

๐Ÿ‡ฉ๐Ÿ‡ชGermany olkoeller Hessen

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

Comments & Activities

  • Issue created by @olkoeller
  • ๐Ÿ‡จ๐Ÿ‡ฆCanada joseph.olstad

    The above report is this a permissions issue?

    There's also a couple patches floating around.

    There is an existing patch for this here:
    ๐Ÿ› Batch finish Force Delete return always status message 0 files cleansed. Fixed

    and another related issue is linked to that.

    Please review if permissions changes and or one of these existing patches this fixes the issue.

    Please report the results here or in the related issues.

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany olkoeller Hessen

    Hi Joseph,
    I think it's not a permission thing because I can delete via Tab Manual filling in the file ids without any problem. But this was working the same checking the files in the List view on Tab List.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada joseph.olstad

    Hi, I'm relying heavily on the community to provide guidance here, let me know which patch "if any" you think might be worth reviewing.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia roshni27

    roshnichordiya โ†’ made their first commit to this issueโ€™s fork.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia roshni27

    Hello,

    I have uploaded a file through the content editor as a user. Then, I logged in as an admin and went to /admin/config/content/fancy_file_delete/list. As a result, I deleted the file following the instructions above.

    I have shared a screenshot for your reference.

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany olkoeller Hessen

    Some of the content like News and Date, the Editor can create, uses mediatypes, where e.g. pdf-files or docx-files can be uploaded.
    So there is a mediatype 'Datei Volltextsuche' for pdf and a mediatype 'Dokument' for the docx.

    The permission rights as an Editor for these Media types are:
    Create new media,
    Edit any media,
    Edit own media,
    Update own media

    The permission rights as an Editor for content types like News and Date are:
    Create new content,
    Edit any content,
    Edit own content,
    Revert revisions,
    View revisions,
    Administer content,
    Revert all revisions
    View all revisions

    To test the functionality of my site I have set up several cypress tests for creating and deleting content and uploaded files to be sure that the main features are working.
    I have also added tests that use the file_fancy_delete list to delete uploaded files. For those tests the test logs in as the admin. When creating content the test logs in as an Editor with the above described permission rights.
    This was working fine for several month. In the meantime I did the drupal core and module updates and from some day these tests for deleteing uploaded files were failing.
    So I tried to delete the files manually and recognised that it doesn't work any more.
    For some reason the deleting with FID Numbers on tab Manual is working as expected, regardless if the file is in use or not.
    So deleting the files on tab list is not working for me wether if the files are still in use or if I delete the content and the media types so that the files are not in use any more.
    The latter has always worked well with my cypress tests using the tab list.
    What am I doing wrong.

  • As per the project description, you will need this patch: https://www.drupal.org/project/drupal/issues/2949017 ๐Ÿ› There is no way to delete file entities of other users Fixed

Production build 0.71.5 2024