Unable to delete files inside folders shared by link
Steps to reproduce
- On server A create a new folder (aka folder1)
- On server A create a new file inside folder1 (aka file1)
- On server A share by link folder1 (allow edit checked)
- Paste link on browser, click on Add to your owncloud and fill ownCloud field with server B url
- On server B accept shared folder
- On server B navigate inside folder1 and check available options for file1
Expected behaviour
Shared by link should have the same behaviour than shared option
Shared by link:

Shared:

Actual behaviour
As user who accepts shared items, we are not able to remove files inside folder shared by link. On 9.0.2 it works fine, shows the same options.
Server configuration
Operating system: Ubuntu 14.04.1 LTS Web server: Apache2 Database: Server version: 5.5.46-0ubuntu0.14.04.2 (Ubuntu) PHP version: PHP 5.5.9-1ubuntu4.14 (cli) (built: Oct 28 2015 01:34:46 ownCloud version: (see ownCloud admin page) ownCloud Enterprise Edition 9.1.0 beta 1 (testing)
The content of config/config.php:
<?php
$CONFIG = array (
'updatechecker' => false,
'supportedDatabases' =>
array (
0 => 'mysql',
1 => 'pgsql',
2 => 'oci',
),
'instanceid' => 'oco48z2585bc',
'passwordsalt' => 'ZZZZ',
'secret' => 'XXXXX',
'trusted_domains' =>
array (
0 => 'localhost',
1 => 'XXXXXX',
),
'datadirectory' => '/opt/owncloud/data',
'overwrite.cli.url' => 'XXXX',
'dbtype' => 'mysql',
'version' => '9.1.0.5',
'dbname' => 'owncloud',
'dbhost' => 'localhost',
'dbtableprefix' => '',
'dbuser' => 'oc_admin',
'dbpassword' => '*** removed for security reasons',
'logtimezone' => 'UTC',
'installed' => true,
'license-key' => '*** removed for security reasons',
);
Are you using encryption:
No
@rullzer
Possibly an issue with share permissions, @rullzer can you have a look ?
Now this is weird... the permission in the DB are 7 when you enable editing... which actually makes the permissions on the mounted link correct. The question is why is there a delete on the link share page. Since we don't allow it.
And why do we allow the files to be deleted.
ah so it is actually the webview that is doing fishy things... because allowediting never sets delete permissions. But the dav endpoint hapily sets them.
@PVince81 I suggest to fix the web view to reflect permissions properly. Then we can decide separatly if we want 'allow editing' to also mean delete
@rullzer sounds good
Ok lets do it :)
PR in #24990
So the thing here is that the public view is being the bad boy. When allowing edit on the link we never set the DELETE permissions. So then we should not allow delete (which the mount correctly does not show).
This is also in line with the edit permission on 'normal' shares. Where edit and delete are separated.
So the real bug here is that you can delete files on and editable link share while those permissions are not granted!
@rullzer when we introduced the ability to create/update/delete files in the web UI of the share link in 9.0, these were activated when the "allow editing" permission was given. Not sure whether it properly set the permission value to 31 back then.
@PVince81 this was also already the case in 8.2 https://github.com/owncloud/core/blob/stable8.2/core/js/shareitemmodel.js#L195
Reopening as the linked PR did not fix the issue, it just made it inconsistent.
it just made it inconsistent.
It made it consistent :wink: But fair enough.
So now the big questions. Should edit permissions also allow deletion of files?
Looks like "share with link" also doesn't set the reshare permissions: https://github.com/owncloud/core/issues/25221
@rullzer would it make sense to simply make new link shares use the permissions 31 at creation time ?
There's another ticket here to introduce CRUDS permissions for link shares too: https://github.com/owncloud/core/issues/20699
Okay, so for reference I tested 8.2 to 9.1 with fed shares and link shares, as created in the web UI. These are the permissions that are created:
+---------------------------------------+-------------+
| name | permissions |
+---------------------------------------+-------------+
| 8.2 fed share readonly | 1 |
| 8.2 fed share readwrite | 7 |
| 8.2 link share readonly | 1 |
| 8.2 link share readwrite | 7 |
| 9.0.2 fed share readonly | 1 |
| 9.0.2 fed share readwrite | 7 |
| 9.0.2 link share readonly | 1 |
| 9.0.2 link share readwrite | 7 |
| 9.1.0 fed share readonly | 1 |
| 9.1.0 fed share readonly + can share | 17 |
| 9.1.0 fed share readwrite | 15 |
| 9.1.0 fed share readwrite + can share | 31 |
| 9.1.0 link share readonly | 1 |
| 9.1.0 link share readwrite | 7 |
+---------------------------------------+-------------+
More ideas:
- [ ] make link shares use permissions 15 for readwrite (no reshare) and 1 for readonly
- [ ] repair step to adjust the permissions of existing link shares
But then also the question about clients, should they also be adjusted to send the same permissions ?
also I noticed that from an API perspective, the link share permission is enforced to be either 1 or 7 regardless of what a client sends. So maybe this enforcing needs to be adjusted too in case clients still sent only 1 or 7 and we'd enforce it to 1 or 15 ?
I've tried to do a federated share to 9.1 with all permissions, then in 9.1 share that file with an interal user again with all permissions and that internal user can't get the file.
Logs:
All federated tests involving a 9.1 server (until now) have failed beacause of this. (Rechecking with 9.0 to confirm; it will take a while)
@jvillafanez federated shares do work for me in 9.1, but you're right about that warning message. I also get it and didn't notice before.
Likely related to the latest change from https://github.com/owncloud/core/issues/24990
The message disappears if I revert https://github.com/owncloud/core/pull/24990 locally
That warning was added recently. It is because we add the storage wrapper at a place we are not supposed to. But to be fair we also did that before.