Repository navigation
Feat/federated sharing - #8184
luka-nextcloud wants to merge 14 commits into
Conversation
|
🐢 Performance warning. |
9af44d8 to
e176ad6
Compare
e176ad6 to
1eca4c9
Compare
|
🐢 Performance warning. |
|
@CarlSchwan @come-nc I would need advice from experts of files_sharing app: |
1eca4c9 to
38e34df
Compare
|
🐢 Performance warning. |
|
🐢 Performance warning. |
8c7bc98 to
866cdf7
Compare
|
🐢 Performance warning. |
866cdf7 to
a3bce6f
Compare
fdeff1a to
2be9ceb
Compare
benjaminfrueh
left a comment
There was a problem hiding this comment.
@luka-nextcloud thanks for working on this! I left some comments, mostly about the attachment part.
One more general thing: the PR doesn't add tests for the new federation code yet. It would be great to have some.
The PR description is still empty. Could you add a short summary of what's included and how to test it?
| // check for users | ||
| foreach ($acls as $acl) { | ||
| if ($acl->getType() === Acl::PERMISSION_TYPE_USER && $acl->getParticipant() === $userId) { | ||
| if (in_array($acl->getType(), [Acl::PERMISSION_TYPE_USER, Acl::PERMISSION_TYPE_REMOTE]) && $acl->getParticipant() === $userId) { |
There was a problem hiding this comment.
This now also matches remote ACLs by participant ID. Since local user IDs can contain @, a local user whose ID is the same as a remote participants cloud ID (e.g. user1@other.server) would get that remote participants permissions. Could we keep remote ACLs out of userCan() and handle the federated case separately?
There was a problem hiding this comment.
This still compares the remote user cloud ID with the local user ID, so a local user whose ID is the same as a remote participant's cloud ID still gets their permissions. I tested and such a local user can read the board and create cards.
Since only DeckShareProvider::create() needs this for the remote sharedBy, maybe keep userCan() for local users only and check remote participants there explicitly, e.g.:
if ($this->userManager->userExists($sharedBy)) {
// existing checkPermission() for local users
} elseif (!$this->permissionService->remoteParticipantCan($boardId, $sharedBy, Acl::PERMISSION_EDIT)) {
$valid = false;
}with remoteParticipantCan() only checking PERMISSION_TYPE_REMOTE ACLs and probably also checking that federation is enabled like externalUserCan() does.
Signed-off-by: Luka Trovic <luka@nextcloud.com>
Signed-off-by: Luka Trovic <luka@nextcloud.com>
Signed-off-by: Luka Trovic <luka@nextcloud.com>
Signed-off-by: Luka Trovic <luka@nextcloud.com>
Signed-off-by: Luka Trovic <luka@nextcloud.com>
Signed-off-by: Luka Trovic <luka@nextcloud.com>
Signed-off-by: Luka Trovic <luka@nextcloud.com>
Signed-off-by: Luka Trovic <luka@nextcloud.com>
Signed-off-by: Luka Trovic <luka@nextcloud.com>
Signed-off-by: Luka Trovic <luka@nextcloud.com>
Signed-off-by: Luka Trovic <luka@nextcloud.com>
Signed-off-by: Luka Trovic <luka@nextcloud.com>
Signed-off-by: Luka Trovic <luka@nextcloud.com>
2be9ceb to
5792eaf
Compare
benjaminfrueh
left a comment
There was a problem hiding this comment.
@luka-nextcloud thanks for the updates, a lot of things are fixed and improved now 🚀
I did a second round of review and added some follow-ups, mostly around the remote user check, the cleanup when someone leaves, the files_sharing dependency and the comment mentions.
More generally: the share lookups are now spread as raw queries across RemoteShareHelper, FilesAppService and DeckShareProvider. Moving them into one place, e.g. a FederatedShareMapper like the existing mappers, would make the logic easier to follow and to test.
Tests for the new federation code and a short PR description with what's included and how to test it would still be great.
| // check for users | ||
| foreach ($acls as $acl) { | ||
| if ($acl->getType() === Acl::PERMISSION_TYPE_USER && $acl->getParticipant() === $userId) { | ||
| if (in_array($acl->getType(), [Acl::PERMISSION_TYPE_USER, Acl::PERMISSION_TYPE_REMOTE]) && $acl->getParticipant() === $userId) { |
There was a problem hiding this comment.
This still compares the remote user cloud ID with the local user ID, so a local user whose ID is the same as a remote participant's cloud ID still gets their permissions. I tested and such a local user can read the board and create cards.
Since only DeckShareProvider::create() needs this for the remote sharedBy, maybe keep userCan() for local users only and check remote participants there explicitly, e.g.:
if ($this->userManager->userExists($sharedBy)) {
// existing checkPermission() for local users
} elseif (!$this->permissionService->remoteParticipantCan($boardId, $sharedBy, Acl::PERMISSION_EDIT)) {
$valid = false;
}with remoteParticipantCan() only checking PERMISSION_TYPE_REMOTE ACLs and probably also checking that federation is enabled like externalUserCan() does.
Signed-off-by: Luka Trovic <luka@nextcloud.com>
Summary
TODO
Checklist