Skip to content

fix(storageprovider): restrict possibility for sharee to remove the owner resource - #897

Merged
butonic merged 2 commits into
opencloud-eu:mainfrom
maki5:fix/delete_owner_shared_folder
Oct 26, 2026
Merged

butonic merged 2 commits into
opencloud-eu:mainfrom
maki5:fix/delete_owner_shared_folder

Conversation

@maki5

@maki5 maki5 commented Oct 21, 2026

Copy link
Copy Markdown

@maki5
maki5 requested review from aduffeck, butonic, micbar, pbleser-oc and rhafer and removed request for rhafer October 22, 2026 07:28
Comment on lines +1408 to +1431
res, err := s.ListReceivedShares(ctx, &collaborationv1beta1.ListReceivedSharesRequest{
Filters: []*collaborationv1beta1.Filter{share.SpaceRootFilter(false)},
})
if err != nil {
return false, err
}
if res.GetStatus().GetCode() != rpc.Code_CODE_OK {
return false, errtypes.NewErrtypeFromStatus(res.GetStatus())
}

for _, receivedShare := range res.GetShares() {
sharedID := receivedShare.GetShare().GetResourceId()
if sharedID.GetSpaceId() != "" && sharedID.GetSpaceId() == sharedID.GetOpaqueId() {
continue // space membership, not a share root
}
// converts shares with backwards compatible ids
if sharedID.GetSpaceId() == "" {
sharedID.StorageId, sharedID.SpaceId = storagespace.SplitStorageID(sharedID.GetStorageId())
}
if utils.ResourceIDEqual(sharedID, id) {
return true, nil
}
}
return false, nil

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can filter by resource id with sth like:

	receivedSharesResponse, err := gatewayClient.ListReceivedShares(ctx, &collaboration.ListReceivedSharesRequest{
		Filters: append([]*collaboration.Filter{
			{
				Type: collaboration.Filter_TYPE_RESOURCE_ID,
				Term: &collaboration.Filter_ResourceId{
					ResourceId: resourceID,
				},
			},
		}, filters...),
	})

@maki5
maki5 requested a review from butonic October 26, 2026 12:11
@butonic
butonic merged commit cb3573f into opencloud-eu:main Oct 26, 2026
19 checks passed
@github-project-automation github-project-automation Bot moved this from Qualification to Done in OpenCloud Team Board Oct 26, 2026
@openclouders openclouders mentioned this pull request Oct 26, 2026
1 task
aduffeck added a commit to aduffeck/reva that referenced this pull request Oct 26, 2026
A grant on the resource itself, like a share, no longer allows taking it
out of its parent. Reverts the gateway check from opencloud-eu#897.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Sharee with the Editor role can delete the owner's shared folder using its id

2 participants