Skip to content

Commit 1c75b03

Browse files
committed
Fixed tests
1 parent a198b1e commit 1c75b03

File tree

3 files changed

+86
-51
lines changed

3 files changed

+86
-51
lines changed

pkg/ocm/share/repository/nextcloud/nextcloud.go

+12-6
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ type EfssShare struct {
8787
Name string `json:"name" validate:"required"`
8888
Token string `json:"token"`
8989
ResourceID struct {
90-
OpaqueID string `json:"opaque_id"`
90+
OpaqueID string `json:"opaque_id" validate:"required"`
9191
} `json:"resource_id" validate:"required"`
92-
ResourceType string `json:"resource_type"`
92+
ResourceType string `json:"resource_type" validate:"omitempty"`
9393
RemoteShareID string `json:"remote_share_id" validate:"required"`
9494
Protocols struct {
9595
WebDAV struct {
@@ -181,7 +181,7 @@ func (sm *Manager) efssShareToOcm(resp *EfssShare) *ocm.Share {
181181
// Parse the JSON struct returned by the PHP SM app into an OCM share object
182182

183183
// first generate the map of access methods, assuming WebDAV is always present
184-
var am = make([]*ocm.AccessMethod, 1, 3)
184+
var am = make([]*ocm.AccessMethod, 0, 3)
185185
am = append(am, share.NewWebDavAccessMethod(conversions.RoleFromOCSPermissions(
186186
conversions.Permissions(resp.Protocols.WebDAV.Permissions)).CS3ResourcePermissions()))
187187
if resp.Protocols.WebApp.ViewMode != "" {
@@ -203,7 +203,10 @@ func (sm *Manager) efssShareToOcm(resp *EfssShare) *ocm.Share {
203203
Grantee: &provider.Grantee{
204204
Type: provider.GranteeType_GRANTEE_TYPE_USER,
205205
Id: &provider.Grantee_UserId{
206-
UserId: resp.Grantee.ID,
206+
UserId: &userpb.UserId{
207+
OpaqueId: resp.Grantee.ID.OpaqueId,
208+
Idp: resp.Grantee.ID.Idp,
209+
},
207210
},
208211
},
209212
Owner: &userpb.UserId{
@@ -322,7 +325,7 @@ func efssReceivedShareToOcm(resp *ReceivedEfssShare) *ocm.ReceivedShare {
322325
// Parse the JSON struct returned by the PHP SM app into an OCM received share object
323326

324327
// first generate the map of protocols, assuming WebDAV is always present
325-
var proto = make([]*ocm.Protocol, 1, 3)
328+
var proto = make([]*ocm.Protocol, 0, 3)
326329
proto = append(proto, share.NewWebDAVProtocol(resp.Share.Protocols.WebDAV.URI, resp.Share.Token, &ocm.SharePermissions{
327330
Permissions: conversions.RoleFromOCSPermissions(conversions.Permissions(resp.Share.Protocols.WebDAV.Permissions)).CS3ResourcePermissions(),
328331
}))
@@ -344,7 +347,10 @@ func efssReceivedShareToOcm(resp *ReceivedEfssShare) *ocm.ReceivedShare {
344347
RemoteShareId: resp.Share.RemoteShareID, // sic, see https://github.com/cs3org/reva/pull/3852#discussion_r1189681465
345348
Grantee: &provider.Grantee{
346349
Id: &provider.Grantee_UserId{
347-
UserId: resp.Share.Grantee.ID,
350+
UserId: &userpb.UserId{
351+
OpaqueId: resp.Share.Grantee.ID.OpaqueId,
352+
Idp: resp.Share.Grantee.ID.Idp,
353+
},
348354
},
349355
},
350356
Owner: resp.Share.Owner.Id,

0 commit comments

Comments
 (0)