Repository navigation
usershareprovider: tighten space manager checks - #993
Merged
Merged
Conversation
A space manager share could get an expiration even when it was the last permanent manager of the space. Once it expired the space was left without a manager. The last manager check in UpdateShare only ran when the new permissions stripped AddGrant or RemoveGrant. We now also run it when the share keeps the manager permissions but ends up with an expiration, either from the update or because it already had one and only the permissions change. Removing an expiration does not need the check. Upstream did this in the gateway, where space grants were still handled at the time (`owncloud#631`). Our space membership lives in the share provider since opencloud-eu#593, so the check goes into UpdateShare next to the existing one, which ignores expiring managers since opencloud-eu#990. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
A space share could carry a single grant management bit, e.g. viewer permissions plus RemoveGrant. decomposedfs treated RemoveGrant alone as the manager marker, so such a grantee could manage the space while the UI showed a viewer. The share provider now rejects space root shares that carry any of AddGrant, UpdateGrant, RemoveGrant or DenyGrant without the full manager permissions, both on create and on update. In decomposedfs IsManager, IsEditor and IsViewer become IsSpaceManager, IsSpaceEditor and IsSpaceViewer and check the role bitmaps instead of a single bit. A space manager needs AddGrant, UpdateGrant and RemoveGrant. DenyGrant is not required, so older manager and coowner grants still count. Upstream put the share check into the gateway (`owncloud#653`). Space membership lives in the share provider since opencloud-eu#593, so the check goes into CreateShare and UpdateShare there. Update requests are checked against the effective new permissions, the same ones the last manager check uses. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
dragonchaser
approved these changes
Nov 11, 2026
butonic
marked this pull request as ready for review
November 11, 2026 12:49
dragonchaser
added a commit
to dragonchaser/reva
that referenced
this pull request
Nov 11, 2026
Resolve the usershareprovider.go conflict in favour of opencloud-eu#993, which landed the same last manager expiration check first. Its mayRemoveLastPermanentManager is the more precise variant: it resolves the permissions and expiration an update leaves on the share, so only expiring managers trigger the check. Drop this branch's specs that opencloud-eu#993 covers with the same or stronger scenarios and keep the one it lacks: an expiration in the payload is ignored when the update mask does not list it. Co-authored-by: Copilot <[email protected]>
butonic
added a commit
to opencloud-eu/opencloud
that referenced
this pull request
Nov 12, 2026
Picks up the space manager checks from opencloud-eu/reva#990 and opencloud-eu/reva#993. go-chi and go-jose move up because reva requires the newer versions. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
butonic
added a commit
to pbleser-oc/opencloud
that referenced
this pull request
Nov 13, 2026
Updating a permission or a space root permission did not check the roles an administrator enabled with GRAPH_AVAILABLE_ROLES. An invite with a disabled role was rejected, but the same role could be set by updating an existing share. We now validate updates against the allowlist, same as invites. The three "without enabling it" scenarios now expect a 400. Their removed lines are padded with blank lines so the line numbers of the scenarios stay the same. ported from `owncloud/ocis#12540`. The reva half (`owncloud/reva#653`) is opencloud-eu/reva#993 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.
Two space membership fixes for the share provider, one commit each:
owncloud/reva#631: an expiration can no longer be set on the last permanent manager of a space. Once it expired the space had no manager left. The last manager check in UpdateShare now also runs when a manager share ends up with an expirationowncloud/reva#653: space root shares that carry some grant management bits without the full manager permissions (e.g. viewer + RemoveGrant) are rejected on create and update. decomposedfsIsManager/IsEditor/IsViewerbecomeIsSpaceManager/IsSpaceEditor/IsSpaceViewerand check the role bitmaps instead of a single bitUpstream did both in the gateway (
updateSpaceShare/addSpaceShare). Since #593 space membership lives in the share provider, so the checks go intoCreateShare/UpdateSharethere, next to the last manager check that #990 made ignore expiring managers.Side effect of 653: OCS requests that share a space with a partial permission set (e.g. the coowner role, which lacks DenyGrant) now get a 400. Same as upstream. I verified that the graph Manager role maps to the full manager bitmap, so graph invites are not affected.
The server half of 653 (
owncloud/ocis#12540) follows in a bump PR againstworkpagagesin opencloud.go test ./internal/... ./pkg/storage/... ./pkg/share/... ./pkg/conversions/...is green. The new specs fail without the fixes.This is based on
workpackages, which does not have #986 yet. 653 also touchesdecomposedfs/spaces.go, but only the three role helper calls, so merging main into workpackages should not conflict there.AI assistance: Claude Code (claude-opus-5-5) ported both changes to the share provider, wrote the specs and ran the tests.