Skip to content

feat(ocm): notify remotes about unshares and permission changes - #1030

Merged
4 commits merged into
opencloud-eu:mainfrom
butonic:port-wp4-805-806-813
Nov 19, 2026
Merged

4 commits merged into
opencloud-eu:mainfrom
butonic:port-wp4-805-806-813

Conversation

@butonic

@butonic butonic commented Nov 18, 2026

Copy link
Copy Markdown
Member

We now send OCM notifications to the receiving instance when the owner removes a federated share (SHARE_UNSHARED) or changes its permissions (SHARE_CHANGE_PERMISSION). The receiving side handles them on /notifications: it deletes the received share or updates its protocols via the newly implemented DeleteOCMCoreShare / UpdateOCMCoreShare. Before, remote users kept stale shares and permissions until something failed.

The ocmcore service also publishes OCMCoreShareCreated and the new OCMCoreShareDelete directly when an events endpoint is configured. The events middleware is not configured on the ocm grpc server, so it never emitted them. The server needs to pass the events config to ocmcore to get user notifications for incoming federated shares.

Review focus:

  • ocmshareprovider.UpdateOCMShare: if the remote can't be notified, the update is reverted and fails. A failed unshare notification only gets logged.
  • ocmd/notifications.go: the endpoint is unauthenticated, like /shares. A notification only matches a received share if both the share id and the grantee match. There is no sender verification yet.
  • The last commit fixes a nil dereference panic and double writes in the notification handler for malformed requests, and adds specs for it.

Review commit by commit: the first three carry the original changes, the last one is ours.

AI assistance: Claude Code (claude-opus-5-5) cherry-picked and resolved the changes, wrote the handler fix, the specs and this description.

2403905 and others added 4 commits November 17, 2026 18:09
When the owner removes an OCM share we now notify the receiving
instance with a SHARE_UNSHARED notification on its /notifications
endpoint. The receiver deletes the received share through the new
DeleteOCMCoreShare implementation, so remote users no longer keep a
dangling share pointing at a resource they cannot access anymore.

A failing notification is logged and does not fail the removal.

Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Updating the permissions of an OCM share now sends a
SHARE_CHANGE_PERMISSION notification to the receiving instance, which
updates the permissions of the received share through
UpdateOCMCoreShare. Before, the remote kept the permissions it got when
the share was created.

The notification payload moves from pkg/ocm/payload into the ocm client
package.

Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
The ocmcore service now publishes OCMCoreShareCreated when a remote
instance creates a share for one of our users, and the new
OCMCoreShareDelete when the remote removes it again. The events are
sent directly when an events endpoint is configured, so they no longer
depend on the events middleware being configured on the ocm grpc
server, which it is not. Consumers like userlog can turn them into
notifications for the receiving user.

Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
The /notifications endpoint is unauthenticated, and a notification
without a notification object, or with a content type other than
application/json, made the handler dereference a nil request and
panic. Several error paths also wrote an error response and then fell
through to write another status. We now return 400 for these requests
before touching the gateway, require the protocol for permission
changes and stop after every error response.

Unsharing a share the receiver no longer knows now answers 404 instead
of failing with an internal error, so a repeated notification is not
reported as a server error.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
butonic added a commit to opencloud-eu/opencloud that referenced this pull request Nov 19, 2026
We temporarily replace reva with the butonic fork at a merge of reva
main and opencloud-eu/reva#1035, which is
stacked on opencloud-eu/reva#1030. This brings
in the OCM unshare and permission change notifications, the ocm core
share events and the fixes to the permissions of OCM shares, on top of
the invite and provider fixes already on reva main.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
@butonic butonic closed this pull request by merging all changes into opencloud-eu:main in 0093d72 Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants