fix: ocm share update

This commit is contained in:
Florian Schade
2024-09-11 15:26:27 +02:00
parent 7c34505f54
commit 3a4c0f33ea
9 changed files with 30 additions and 21 deletions

View File

@@ -0,0 +1,6 @@
Bugfix: Allow update of ocm shares
We fixed a bug that prevented ocm shares to be updated or removed.
https://github.com/owncloud/ocis/pull/9980
https://github.com/owncloud/ocis/issues/9926

View File

@@ -2,6 +2,8 @@ Enhancement: Bump reva
Bumps reva version
https://github.com/owncloud/ocis/pull/9980
https://github.com/owncloud/ocis/pull/9981
https://github.com/owncloud/ocis/pull/9981
https://github.com/owncloud/ocis/pull/9920
https://github.com/owncloud/ocis/pull/9879

2
go.mod
View File

@@ -15,7 +15,7 @@ require (
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/coreos/go-oidc/v3 v3.11.0
github.com/cs3org/go-cs3apis v0.0.0-20240724121416-062c4e3046cb
github.com/cs3org/reva/v2 v2.23.1-0.20240909172158-5fd1e89e1557
github.com/cs3org/reva/v2 v2.24.1-0.20240911132317-de8cea1f9e72
github.com/dhowden/tag v0.0.0-20230630033851-978a0926ee25
github.com/dutchcoders/go-clamd v0.0.0-20170520113014-b970184f4d9e
github.com/egirna/icap-client v0.1.1

4
go.sum
View File

@@ -255,8 +255,8 @@ github.com/crewjam/saml v0.4.14 h1:g9FBNx62osKusnFzs3QTN5L9CVA/Egfgm+stJShzw/c=
github.com/crewjam/saml v0.4.14/go.mod h1:UVSZCf18jJkk6GpWNVqcyQJMD5HsRugBPf4I1nl2mME=
github.com/cs3org/go-cs3apis v0.0.0-20240724121416-062c4e3046cb h1:KmYZDReplv/yfwc1LNYpDcVhVujC3Pasv6WjXx1haSU=
github.com/cs3org/go-cs3apis v0.0.0-20240724121416-062c4e3046cb/go.mod h1:yyP8PRo0EZou3nSH7H4qjlzQwaydPeIRNgX50npQHpE=
github.com/cs3org/reva/v2 v2.23.1-0.20240909172158-5fd1e89e1557 h1:ZVjUBlOU4jfRVSW3xCc0GKxXsYJzwZ7LTfKlqnWvXMw=
github.com/cs3org/reva/v2 v2.23.1-0.20240909172158-5fd1e89e1557/go.mod h1:p7CHBXcg6sSqB+0JMNDfC1S7TSh9FghXkw1kTV3KcJI=
github.com/cs3org/reva/v2 v2.24.1-0.20240911132317-de8cea1f9e72 h1:J1CCIbBOKVGEqEng3OwZzeX5jVLb8iTzM251D2C8oyo=
github.com/cs3org/reva/v2 v2.24.1-0.20240911132317-de8cea1f9e72/go.mod h1:p7CHBXcg6sSqB+0JMNDfC1S7TSh9FghXkw1kTV3KcJI=
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=

View File

@@ -925,7 +925,7 @@ func (g BaseGraphService) updateOCMPermission(ctx context.Context, permissionID
return nil, err
}
condition, err := roleConditionForResourceType(resourceInfo)
condition, err := federatedRoleConditionForResourceType(resourceInfo)
if err != nil {
return nil, err
}
@@ -1030,10 +1030,12 @@ func (g BaseGraphService) updateUserShare(ctx context.Context, permissionID stri
if err != nil {
return nil, err
}
condition, err := roleConditionForResourceType(resourceInfo)
if err != nil {
return nil, err
}
var cs3UpdateShareReq collaboration.UpdateShareRequest
// When updating a space root we need to reference the share by resourceId and grantee
if IsSpaceRoot(itemID) {

View File

@@ -38,10 +38,6 @@ const (
UnifiedRoleManagerID = "312c0871-5ef7-4b3a-85b6-0e4074c64049"
// UnifiedRoleSecureViewerID Unified role secure viewer id.
UnifiedRoleSecureViewerID = "aa97fe03-7980-45ac-9e50-b325749fd7e6"
// UnifiedRoleFederatedViewerID Unified role federated viewer id.
UnifiedRoleFederatedViewerID = "be531789-063c-48bf-a9fe-857e6fbee7da"
// UnifiedRoleFederatedEditorID Unified role federated editor id.
UnifiedRoleFederatedEditorID = "36279a93-e4e3-4bbb-8a23-53b05b560963"
// Wile the below conditions follow the SDDL syntax, they are not parsed anywhere. We use them as strings to
// represent the constraints that a role definition applies to. For the actual syntax, see the SDDL documentation

View File

@@ -65,14 +65,6 @@ var themeDefaults = KV{
"label": "UnifiedRoleSecureView",
"iconName": "shield",
},
unifiedrole.UnifiedRoleFederatedViewerID: KV{
"label": "UnifiedRoleFederatedViewer",
"iconName": "eye",
},
unifiedrole.UnifiedRoleFederatedEditorID: KV{
"label": "UnifiedRoleFederatedEditor",
"iconName": "pencil",
},
},
},
}

View File

@@ -31,14 +31,15 @@ import (
ocm "github.com/cs3org/go-cs3apis/cs3/sharing/ocm/v1beta1"
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
typespb "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
"github.com/google/uuid"
"github.com/pkg/errors"
"google.golang.org/genproto/protobuf/field_mask"
"github.com/cs3org/reva/v2/pkg/errtypes"
"github.com/cs3org/reva/v2/pkg/ocm/share"
"github.com/cs3org/reva/v2/pkg/ocm/share/repository/registry"
"github.com/cs3org/reva/v2/pkg/utils"
"github.com/cs3org/reva/v2/pkg/utils/cfg"
"github.com/google/uuid"
"github.com/pkg/errors"
"google.golang.org/genproto/protobuf/field_mask"
)
func init() {
@@ -466,7 +467,17 @@ func (m *mgr) UpdateShare(ctx context.Context, user *userpb.User, ref *ocm.Share
}
}
return s, nil
clone, err := cloneShare(s)
if err != nil {
return nil, err
}
m.model.Shares[s.Id.OpaqueId] = clone
if err := m.save(); err != nil {
return nil, errors.Wrap(err, "error saving share")
}
return clone, nil
}
}
}

2
vendor/modules.txt vendored
View File

@@ -367,7 +367,7 @@ github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1
github.com/cs3org/go-cs3apis/cs3/storage/registry/v1beta1
github.com/cs3org/go-cs3apis/cs3/tx/v1beta1
github.com/cs3org/go-cs3apis/cs3/types/v1beta1
# github.com/cs3org/reva/v2 v2.23.1-0.20240909172158-5fd1e89e1557
# github.com/cs3org/reva/v2 v2.24.1-0.20240911132317-de8cea1f9e72
## explicit; go 1.21
github.com/cs3org/reva/v2/cmd/revad/internal/grace
github.com/cs3org/reva/v2/cmd/revad/runtime