nextcloud / nextcloud/groupfolders

GroupFolders to trash - file permissions issues

Open
#2,263 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage bug feature: trashbin
Dominant language
PHP
Stars
343
Forks
106
Avg merge
2d 3h
Merged PRs (30d)
34

Description

How to use GitHub
  • Please use the šŸ‘ reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

The issue you are facing:

A folder or file that has been deleted from inside a GroupFolder can’t be deleted.

Is this the first time you’ve seen this error? (Y/N): Y

This might have something to do with access permissions but not sure what am I doing wrong.

The output of your Nextcloud log in Admin > Logging:

[webdav] Fatal: Exception: Failed to remove item from trashbin at <<closure>>

 0. /var/www/nextcloud/apps/files_trashbin/lib/Trash/TrashManager.php line 68
    OCA\GroupFolders\Trash\TrashBackend->removeItem()
 1. /var/www/nextcloud/apps/files_trashbin/lib/Sabre/TrashRoot.php line 54
    OCA\Files_Trashbin\Trash\TrashManager->removeItem()
 2. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php line 179
    OCA\Files_Trashbin\Sabre\TrashRoot->delete()
 3. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 281
    Sabre\DAV\Tree->delete()
 4. /var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
    Sabre\DAV\CorePlugin->httpDelete()
 5. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 472
    Sabre\DAV\Server->emit()
 6. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 253
    Sabre\DAV\Server->invokeMethod()
 7. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 321
    Sabre\DAV\Server->start()
 8. /var/www/nextcloud/apps/dav/lib/Server.php line 358
    Sabre\DAV\Server->exec()
 9. /var/www/nextcloud/apps/dav/appinfo/v2/remote.php line 35
    OCA\DAV\Server->exec()
10. /var/www/nextcloud/remote.php line 170
    require_once("/var/www/nextcl ... p")

DELETE /remote.php/dav/trashbin/2FA20EFE-6C76-4FF9-8740-F9EE35625126/trash
from 10.xx.xx.xx by 2FA20EFE-6C76-4FF9-8740-F9EE35625126 at 2023-02-08T09:35:36+00:00
[webdav] Fatal: OCP\Files\NotPermittedException:  at <<closure>>

 0. /var/www/nextcloud/apps/files_trashbin/lib/Trash/TrashManager.php line 68
    OCA\GroupFolders\Trash\TrashBackend->removeItem()
 1. /var/www/nextcloud/apps/files_trashbin/lib/Sabre/AbstractTrash.php line 89
    OCA\Files_Trashbin\Trash\TrashManager->removeItem()
 2. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php line 179
    OCA\Files_Trashbin\Sabre\AbstractTrash->delete()
 3. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 281
    Sabre\DAV\Tree->delete()
 4. /var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
    Sabre\DAV\CorePlugin->httpDelete()
 5. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 472
    Sabre\DAV\Server->emit()
 6. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 253
    Sabre\DAV\Server->invokeMethod()
 7. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 321
    Sabre\DAV\Server->start()
 8. /var/www/nextcloud/apps/dav/lib/Server.php line 358
    Sabre\DAV\Server->exec()
 9. /var/www/nextcloud/apps/dav/appinfo/v2/remote.php line 35
    OCA\DAV\Server->exec()
10. /var/www/nextcloud/remote.php line 170
    require_once("/var/www/nextcl ... p")

DELETE /remote.php/dav/trashbin/2FA20EFE-6C76-4FF9-8740-F9EE35625126/trash/New%20Text%20Document.txt.d1670593783
from 10.xx.xx.xx by 2FA20EFE-6C76-4FF9-8740-F9EE35625126 at 2023-02-08T09:42:33+00:00
Steps to reproduce

I have a number of GroupFolders, one of which is called Templates.
My user belongs to a group that has full control (Write,Share,Delete) and same group has ā€œAdvanced Permissionsā€ on that folder too.

The Advanced settings allow for self-imposed denial of access to Write&Delete within the folder (this is to allow only intentional interventions in the folder).

Now, if I undo the ā€œAdvanced Permissionsā€ and delete a file/folder from within the Templates it will go in to the Trash and at this stage I can empty the trash too.

However, if I reapply the ā€œAdvanced Permissionsā€ while the deleted file/folder is still in the trash it will get stuck and you can’t restore or delete it.

And now an interesting behaviour of the trash bin; If I attempt to restore a file from the trash after again changing ā€œAdvanced Permissionsā€ to allow all, the file will go back to the Templates folder and will disappear without a trace (shows up for literarily a second and then gets deleted without going to the trash).

Expected behaviour

I would assume that once a file/folder gets to the trash it should be delete regardless of permissions applied on the source location after the delete action. Files/folders should get autodeleted from trash.

Actual behaviour

Unable to "permanently delete" content of the trash and auto delete trash doesn't work too.

Server configuration

Nextcloud version (eg, 20.0.5): 24.0.9
Operating system and version (eg, Ubuntu 20.04): Debian 11
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.54
PHP version (eg, 7.4): 7.4
Group folders: 12.0.3

Updated from an older Nextcloud/ownCloud or fresh install:
Updated number of times from version 22
Where did you install Nextcloud from:
nextcloud.com tar.gz
Are you using external storage, if yes which one: local/s3/smb/sftp/...
local
Are you using encryption: yes/no
no
Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/Saml/...
LDAP

Client configuration

Browser:
Firefox 109
Operating system:
Windows 10 21H2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the DELETE requests through apps/files_trashbin/lib/Trash/TrashManager.php and the GroupFolders TrashBackend->removeItem() path shown in the stack traces. Reproduce the permission change while an item is in the trash, then verify that permanent deletion, automatic cleanup, and restoration no longer fail or immediately remove the restored item.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
authorization, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.