Skip to content

Files can not be deleted by the retention job if the file is not deletable in the user mount point #137

@danxuliu

Description

@danxuliu

The retention job only takes into account the first node of the first mount point of a file to be deleted. If that node is not deletable the retention job will fail to delete it, even if it would be deletable when using a node from another mount point.

Moreover, in some cases the retention job may not be able to delete a file even if there is a single mount point if the file is not deletable in that mount point (for example, if it is in a group folder without delete permissions). -> Extracted to #142

Steps to reproduce

  • As an admin, create users user0 and user1
  • Log in as user0
  • Open the Files app
  • Create a folder
  • Share the folder with user1
  • Remove delete permissions from the share
  • Open the folder
  • Upload an old file (a file with an mtime from months or years ago)
  • Add a tag deleteTest to that file
  • Log out
  • Log in as user1 (so the mount point for the shared folder is created)
  • Log out
  • As an admin, create user user2
  • Transfer ownership of files from user0 to user2 with occ files:transfer-ownership user0 user2
  • Delete user0 with occ user:delete user0 (so the mount point for the shared folder becomes the first one for the file)
  • Log in as user1
  • Do NOT log out (so the shared storage for the shared folder is kept "alive"; this needs to be done after the share was transferred)
  • As an admin, open the Flow admin settings
  • Create a new retention job to delete files with tag deleteTest and a modification time older than 10 days
  • Set debug level for Nextcloud logs with occ config:system:set loglevel --type integer --value 0
  • Wait patiently until the retention job runs or force its execution with occ background-job:execute --force-execute XXX (requires Add a command to show info about a background job and force-execute it server#27217)
    • The following SQL query can be used to find out the job ID; if there is more than one retention job look for the matching tag ID in the arguments: SELECT id, argument FROM oc_jobs WHERE class LIKE "%Files_Retention%"

Expected behaviour

The file is deleted.

Actual behaviour

The file is not deleted. Nextcloud logs show a NotPermittedException when trying to delete the file with the retention job.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions