Skip to content

Conversation

@schiessle
Copy link
Contributor

@schiessle schiessle commented Apr 11, 2016

bring back CRUDS permissions for federated shares

  • Display all permissions in share dialog
  • update webdav permissions (oc:permission are set correctly, it always contain the delete permission because delete === unshare should always be allowed)
  • update oc:share-permissions (here we can also show the "correct" delete permissions for shared folders) (needs always return the complete permissions the file was shared with #23945)
  • recipients of federated shares should respect the permissions
  • update file cache if propfind returns new permission
  • storage->getPermissions() should also do a propfind

Open Issues:

@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @blizzz, @PVince81 and @rullzer to be potential reviewers

@schiessle schiessle force-pushed the cruds-for-federated-shares branch from 51a09d9 to 351d0bd Compare April 12, 2016 10:16
@schiessle
Copy link
Contributor Author

@icewind1991 I have a question regarding the last commit in this PR (51643f4)

In order to make the remote server respect the share permissions I updated the master/index.php/apps/files_sharing/shareinfo?t=<some_token> call to return the right permissions.
This works great. The remote server which received the share calls the shareinfo every time and gets the updated permissions, except one case. If the received permission was 31 the server stops calling shareinfo. The share info call happens in two places:

https://github.com/owncloud/core/blob/master/apps/files_sharing/lib/external/scanner.php#L86
https://github.com/owncloud/core/blob/master/apps/files_sharing/lib/external/storage.php#L184

Do you have a idea why we call it on every request as long as the permission was < 31 and stop calling it as soon as the permission was set to 31? I couldn't find the reason.

@schiessle
Copy link
Contributor Author

code is ready and works... please start to review it... I might add additional unit tests in the mean time.

cc @DeepDiver1975 would be great if you could have a look at the webdav related changes. Thanks!

@@ -62,29 +62,37 @@
$rootInfo = \OC\Files\Filesystem::getFileInfo($path);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing for now... but we should really get rid of this ajax file and move it to a proper controller...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, was also my thought... 😉

@rullzer
Copy link
Contributor

rullzer commented Apr 15, 2016

You probabaly need to rebase as that share permissions fix is already in master.

@schiessle schiessle force-pushed the cruds-for-federated-shares branch 2 times, most recently from a9757f7 to 254f64d Compare April 15, 2016 09:00
@schiessle
Copy link
Contributor Author

You probabaly need to rebase as that share permissions fix is already in master.

Was already up-to-date enough to contain the fix... but I rebased it once more to be on latest master.

@schiessle schiessle force-pushed the cruds-for-federated-shares branch 2 times, most recently from 1358eef to 29c5af9 Compare April 15, 2016 11:30
@schiessle schiessle force-pushed the cruds-for-federated-shares branch from 29c5af9 to 52644eb Compare April 18, 2016 10:14
@schiessle
Copy link
Contributor Author

permission updated according to #24017
@rullzer, @DeepDiver1975... please review. Thanks!

@rullzer
Copy link
Contributor

rullzer commented Apr 18, 2016

https://github.com/owncloud/core/pull/23918/files#diff-2e1f33af47835fc7dab530c048c95f9aL157 <-- shouldn't that go as well?

Currently federated shares are shared by default without sharing permissions and without delete permissions. I get that this was the old behaviour. But now it looks weird.

* @param string $user
* @return int
*/
public function getSharePermissions() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user is actually a bit misleading here...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that at the calling end the token is stored in the "user"-field. So it is always somehow misleading, either at the calling end or at the receiving end.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... but maybe it is better to call it "token" at this place to make it less confusing for the method as such

@schiessle
Copy link
Contributor Author

Currently federated shares are shared by default without sharing permissions and without delete permissions. I get that this was the old behaviour. But now it looks weird.

Can you elaborate on it? What do you think looks wired. The point of the commit you refer to is that if a server receives a propfind from a user who mounted a federated share we need to return the permissions the file was shared with. This doesn't change the default permissions.

@rullzer
Copy link
Contributor

rullzer commented Apr 18, 2016

@schiesbn when you initially share the file. Permissions send to the OCS Share API are 7.

It is weird from a user point I think. Because if I share a folder locally it is shared by default with permissions 31. And federated defaults to 7.

@schiessle
Copy link
Contributor Author

It is weird from a user point I think. Because if I share a folder locally it is shared by default with permissions 31. And federated defaults to 7.

Of course we could change the default share permissions to match the local shares.

@schiessle
Copy link
Contributor Author

@rullzer see my last commit... I removed the special handling for remote shares regarding the default permissions

@rullzer
Copy link
Contributor

rullzer commented Apr 18, 2016

👍

@schiessle
Copy link
Contributor Author

need a second reviewer... @PVince81 @DeepDiver1975 @icewind1991 ? Thanks!

return $node->getSharePermissions();
$propFind->handle(self::SHARE_PERMISSIONS_PROPERTYNAME, function() use ($node, $httpRequest) {
return $node->getSharePermissions(
$httpRequest->getRawServerValue('PHP_AUTH_USER')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fairly sure this will only work for some server setups

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate on it? What could be used instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LukasReschke since you are working on some auth related stuff for 9.1... do you see any issues with it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this should work considering the fact that OC::handleAuthHeaders does some mapping magic.

@schiessle schiessle force-pushed the cruds-for-federated-shares branch from 87f4e2a to df58cdf Compare April 20, 2016 14:04
@schiessle
Copy link
Contributor Author

@icewind1991 please have another look, I hope you like my last update 😉

@schiessle schiessle force-pushed the cruds-for-federated-shares branch from df58cdf to fa221ce Compare April 20, 2016 14:51
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we always set the share permission to a default value in propfind I would expect this to always be true

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, see my last changes: e906796

$response = $this->propfind($path);
if (isset($response['{http://open-collaboration-services.org/ns}share-permissions'])) {
$permissions = $response['{http://open-collaboration-services.org/ns}share-permissions'];
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to also check for the regular permissions field in the propfind result for older oc remotes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For old federated shares we set the permissions always to 31 and just let the recipient end for example decide to accept a write request or not. That's exactly what I do now in the else block.

@icewind1991
Copy link
Contributor

Do federated share correctly handle the owner losing permissions?

(Fed. reshare an internal share and then the owner of the internal share removing permissions)

@schiessle
Copy link
Contributor Author

schiessle commented Apr 21, 2016

Do federated share correctly handle the owner losing permissions?
(Fed. reshare an internal share and then the owner of the internal share removing permissions)

Good question. I just tested it.
Since we now have a flat re-share list this is not really a issue.
If internalUser1 shares a file with internaleUser2 and then internalUser2 re-shares it with remoteUser1, the owner of the remote share will be internalUser1. So he can add/remove permissions for both shares (internal and federated) independent from each other. Same behavior as for internal re-shares.

@schiessle
Copy link
Contributor Author

@icewind1991 I think all comments are addressed... Would be great to get this merged to move forward.

@icewind1991
Copy link
Contributor

👍

@lock
Copy link

lock bot commented Aug 6, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants