feat(federation): Federated table sharing#2786
Conversation
403289e to
ba97e23
Compare
4da0386 to
35b4e5e
Compare
1bf2714 to
e948b30
Compare
8a02508 to
63c7628
Compare
63c7628 to
c66887c
Compare
grnd-alt
left a comment
There was a problem hiding this comment.
Did not entirely check all code paths yet. But the general structure looks good 🔥
What I noticed though: when creating a federated share it instantly shows as a new table on the receiving user's view. In Deck I think we're sending a notification that the user has to confirm before it shows in the app, so user's don't get spammed.
5be9580 to
4beef8f
Compare
Thanks for the feedback! After checking Deck's |
4beef8f to
a38af3d
Compare
Assisted-by: Claude:claude-sonnet-4-6 Signed-off-by: Benjamin Frueh <benjamin.frueh@gmail.com>
a38af3d to
e6485cc
Compare
| namespace OCA\Tables\AppInfo; | ||
|
|
||
| use Exception; | ||
| use OC\OCM\OCMSignatoryManager; |
There was a problem hiding this comment.
Would be cool (and more sustainable) when there will be a public interface for this, but definitely out of scope for now, might be accompanied by an issue against server if there is not one yet.
(On second look it might be more complicated than that)
blizzz
left a comment
There was a problem hiding this comment.
some things that would be good to have, but no definite blocker by reading the code
| if ($this->federationService->isNodeFederated($tableId, 'table')) { | ||
| $table = $this->tableService->find($tableId, true); | ||
| return new DataResponse($this->federationService->getColumns($table)); | ||
| } |
There was a problem hiding this comment.
Smells a bit as if it wants to be in the try-block, too.
| if ($this->federationService->isNodeFederated($viewId, 'view')) { | ||
| $view = $this->viewService->find($viewId, true); | ||
| return new DataResponse($this->federationService->getColumns($view)); | ||
| } |
| if ($this->federationService->isNodeFederated($tableId, 'table')) { | ||
| $table = $this->tableService->find($tableId, true); | ||
| return new DataResponse($this->federationService->getRows($table)); | ||
| } |
There was a problem hiding this comment.
and this might want to be within the handleError() callback?
| public function presentInView(int $id, int $viewId): DataResponse { | ||
| if ($this->federationService->isNodeFederated($viewId, 'view')) { | ||
| return new DataResponse(['present' => true]); | ||
| } |
| #[RequirePermission(permission: Application::PERMISSION_UPDATE, typeParam: 'nodeCollection')] | ||
| #[ApiRoute(verb: 'PUT', url: '/api/2/{nodeCollection}/{nodeId}/rows/{rowId}', requirements: ['nodeCollection' => '(tables|views)', 'nodeId' => '(\d+)'])] | ||
| public function updateRow(string $nodeCollection, int $nodeId, int $rowId, mixed $data): DataResponse { | ||
| if (is_string($data)) { |
There was a problem hiding this comment.
$data could be of type string|array then?
| use OCP\Migration\IOutput; | ||
| use OCP\Migration\SimpleMigrationStep; | ||
|
|
||
| class Version002003Date20260630000000 extends SimpleMigrationStep { |
There was a problem hiding this comment.
afraid this is sorted not at latest and might not run, but i might be wrong
| } | ||
|
|
||
| public function notifyPermissionUpdate(Share $share): void { | ||
| $this->proxy->sendNotification( |
There was a problem hiding this comment.
what if any of those requests do not get through (maybe the remote nextcloud is being updated), will they be retried?
| <referencedClass name="Doctrine\DBAL\Types\Types" /> | ||
| <referencedClass name="OC\Core\Command\Base" /> | ||
| <referencedClass name="OC\Http\Client\Response" /> | ||
| <referencedClass name="OC\OCM\OCMSignatoryManager" /> |
| <referencedClass name="Doctrine\DBAL\Schema\Table" /> | ||
| <referencedClass name="Doctrine\DBAL\Types\Types" /> | ||
| <referencedClass name="OC\Core\Command\Base" /> | ||
| <referencedClass name="OC\Http\Client\Response" /> |
| $body->rewind(); | ||
|
|
||
| if (!is_array(json_decode($content, true))) { | ||
| throw new \Exception('Error parsing JSON response', $status); |
There was a problem hiding this comment.
Here and and other places, throwing a generic \Exception is broad, and so would be catching them.
| #[CORS] | ||
| #[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT)] | ||
| public function indexTableColumns(int $tableId, ?int $viewId): DataResponse { | ||
| if ($this->federationService->isNodeFederated($tableId, 'table')) { |
There was a problem hiding this comment.
and this actually throws when federation is disabled
There was a problem hiding this comment.
same in the method below
and in RowController
and in the places in the RowOCSController
Signed-off-by: samin-z <samin.zavarkesh@gmail.com>
Federated table sharing
Allows sharing tables with users on other Nextcloud instances.
Todo
🏁 Checklist
/backport to stableX.X🤖 AI (if applicable)