Repository navigation
fix(ocm): align ocm share permissions with the shared resource type - #1035
Merged
Merged
Conversation
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]>
The gateway added the storage grant for a new OCM share without looking at the status the ocm share provider returned. When the federated instance was unreachable the share was not created, but the resource still got a grant for the remote user. We now return the error status before touching the storage provider. Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Updating the permissions of an OCM share only changed the share in the ocm share provider. The grant on the shared resource kept the old permissions. The gateway now fetches the updated share and updates the grant with its webdav permissions and expiration. Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
The write permission of an incoming webdav protocol also granted ListGrants, and the share permission granted Reshare. Neither belongs to the editor role, so the received share showed up with a role that does not match any of ours. Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
The write permission of an incoming webdav protocol always granted CreateContainer, Delete and Move. On a file share those don't match the file editor role. We now pass the resource type of the share or notification to ToOCMProtocol and only add them for folders. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
The gateway synced the storage grant even when the ocm share provider failed to update the share, e.g. because the remote could not be notified and the update was reverted. It also took the permissions from the first access method and panicked on a share without access methods. We now return the error status first and use the permissions of the webdav access method, skipping the grant when there is none. Also adds a test for the permissions ToOCMProtocol derives for file and folder shares. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
butonic
force-pushed
the
port-wp4-807-808-809-812
branch
from
November 19, 2026 09:31
5a7651a to
04c5ccb
Compare
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]>
fschade
approved these changes
Nov 19, 2026
butonic
added a commit
to opencloud-eu/opencloud
that referenced
this pull request
Nov 19, 2026
We bump reva to 0093d72f4c9d, the merge of opencloud-eu/reva#1035 on reva main. 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. It also pulls in the revision cleanup from opencloud-eu/reva#895. Its strategy defaults to empty, which keeps all revisions, so nothing changes until we wire up the option. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four fixes to how OCM share permissions end up on the shared resource and on the received share:
ListGrants, and thesharepermission no longer grantsReshare.CreateContainer,DeleteandMoveare only granted for folder shares./sharesand the permission change notification pass the resource type toToOCMProtocol, so a file share gets the file editor permissions.Review focus:
gateway.UpdateOCMShare: the last commit returns early when the share update failed and takes the grant permissions from the webdav access method instead ofAccessMethods[0], which panicked on a share without access methods.CreateOCMSharestill usesAccessMethods[0]like before.resourceTypenow only gets the file permissions forwrite.resourceTypeis required by the OCM spec and validated on both endpoints.Review commit by commit: the first four carry the original fixes, the last one is ours and adds a test for the file/folder permissions.
stacked on #1030, only the last five commits belong to this PR.
AI assistance: Claude Code (claude-opus-5-5) cherry-picked the fixes, resolved the conflicts, wrote the gateway guard, the test and this description.