Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hardcode access methods for outgoing OCM shares from OC/NC #4172

Merged
merged 3 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/unreleased/permissions-sm-nc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: hardcode access methods for outgoing OCM shares from OC/NC

This is a workaround until sciencemesh/nc-sciencemesh#45 is properly implemented

https://github.com/cs3org/reva/pull/4172
11 changes: 8 additions & 3 deletions pkg/ocm/share/repository/nextcloud/nextcloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,15 @@ func (sm *Manager) efssShareToOcm(resp *ShareAltMap) *ocm.Share {
Ctime: resp.Ctime,
Mtime: resp.Mtime,
ShareType: ocm.ShareType_SHARE_TYPE_USER,
// FIXME the SM app does not provide methods and does not include permissions, see https://github.com/sciencemesh/nc-sciencemesh/issues/45
// the correct logic here is to include those access methods that come in the payload
AccessMethods: []*ocm.AccessMethod{
share.NewWebDavAccessMethod(conversions.RoleFromOCSPermissions(conversions.Permissions(resp.Permissions)).CS3ResourcePermissions()),
// FIXME share.NewWebAppAccessMethod() missing from SM app
// FIXME share.NewDataTxAccessMethod()
// FIXME for webdav we should use conversions.RoleFromOCSPermissions(conversions.Permissions(resp.Permissions))).CS3ResourcePermissions()
share.NewWebDavAccessMethod(conversions.NewEditorRole().CS3ResourcePermissions()),
// FIXME add if apps are supported
// share.NewWebappAccessMethod(appprovider.ViewMode_VIEW_MODE_READ_WRITE),
// FIXME add if datatx are supported
// share.NewTransferAccessMethod(),
},
}
}
Expand Down
8 changes: 6 additions & 2 deletions pkg/ocm/share/repository/nextcloud/nextcloud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,9 @@ var _ = Describe("Nextcloud", func() {
OpaqueId: "f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c",
},
AccessMethods: []*ocm.AccessMethod{
masked_share.NewWebDavAccessMethod(conversions.RoleFromOCSPermissions(conversions.Permissions(1)).CS3ResourcePermissions()),
masked_share.NewWebDavAccessMethod(conversions.NewEditorRole().CS3ResourcePermissions()),
// masked_share.NewWebappAccessMethod(appprovider.ViewMode_VIEW_MODE_READ_WRITE),
// masked_share.NewTransferAccessMethod(),
},
Ctime: &types.Timestamp{
Seconds: 1234567890,
Expand Down Expand Up @@ -436,7 +438,9 @@ var _ = Describe("Nextcloud", func() {
},
ShareType: ocm.ShareType_SHARE_TYPE_USER,
AccessMethods: []*ocm.AccessMethod{
masked_share.NewWebDavAccessMethod(conversions.RoleFromOCSPermissions(conversions.Permissions(1)).CS3ResourcePermissions()),
masked_share.NewWebDavAccessMethod(conversions.NewEditorRole().CS3ResourcePermissions()),
// masked_share.NewWebappAccessMethod(appprovider.ViewMode_VIEW_MODE_READ_WRITE),
// masked_share.NewTransferAccessMethod(),
},
Token: "some-token",
}))
Expand Down
Loading