Fix fallout of reva bump

reva tries to avoid copying proto messages now. This changed some calls
to take pointers now (mainly e.g. FormatResourceId())
This commit is contained in:
Ralf Haferkamp
2024-07-11 15:21:56 +02:00
parent a33dd51581
commit ff6674f97b
40 changed files with 283 additions and 234 deletions
+2 -2
View File
@@ -64,7 +64,7 @@ func WithResource(ref *provider.Reference, addSpace bool) ActivityOption {
} }
vars["resource"] = Resource{ vars["resource"] = Resource{
ID: storagespace.FormatResourceID(*info.GetId()), ID: storagespace.FormatResourceID(info.GetId()),
Name: info.GetName(), Name: info.GetName(),
} }
@@ -111,7 +111,7 @@ func WithTrashedResource(ref *provider.Reference, rid *provider.ResourceId) Acti
if item.GetKey() == rid.GetOpaqueId() { if item.GetKey() == rid.GetOpaqueId() {
vars["resource"] = Resource{ vars["resource"] = Resource{
ID: storagespace.FormatResourceID(*rid), ID: storagespace.FormatResourceID(rid),
Name: filepath.Base(item.GetRef().GetPath()), Name: filepath.Base(item.GetRef().GetPath()),
} }
+6 -6
View File
@@ -158,7 +158,7 @@ func (a *ActivitylogService) AddActivityTrashed(resourceID *provider.ResourceId,
} }
// store activity on trashed item // store activity on trashed item
if err := a.storeActivity(storagespace.FormatResourceID(*resourceID), eventID, 0, timestamp); err != nil { if err := a.storeActivity(storagespace.FormatResourceID(resourceID), eventID, 0, timestamp); err != nil {
return fmt.Errorf("could not store activity: %w", err) return fmt.Errorf("could not store activity: %w", err)
} }
@@ -183,7 +183,7 @@ func (a *ActivitylogService) AddSpaceActivity(spaceID *provider.StorageSpaceId,
return fmt.Errorf("could not parse space id: %w", err) return fmt.Errorf("could not parse space id: %w", err)
} }
rid.OpaqueId = rid.GetSpaceId() rid.OpaqueId = rid.GetSpaceId()
return a.storeActivity(storagespace.FormatResourceID(rid), eventID, 0, timestamp) return a.storeActivity(storagespace.FormatResourceID(&rid), eventID, 0, timestamp)
} }
@@ -218,7 +218,7 @@ func (a *ActivitylogService) RemoveActivities(rid *provider.ResourceId, toDelete
} }
return a.store.Write(&microstore.Record{ return a.store.Write(&microstore.Record{
Key: storagespace.FormatResourceID(*rid), Key: storagespace.FormatResourceID(rid),
Value: b, Value: b,
}) })
} }
@@ -232,11 +232,11 @@ func (a *ActivitylogService) RemoveResource(rid *provider.ResourceId) error {
a.lock.Lock() a.lock.Lock()
defer a.lock.Unlock() defer a.lock.Unlock()
return a.store.Delete(storagespace.FormatResourceID(*rid)) return a.store.Delete(storagespace.FormatResourceID(rid))
} }
func (a *ActivitylogService) activities(rid *provider.ResourceId) ([]RawActivity, error) { func (a *ActivitylogService) activities(rid *provider.ResourceId) ([]RawActivity, error) {
resourceID := storagespace.FormatResourceID(*rid) resourceID := storagespace.FormatResourceID(rid)
records, err := a.store.Read(resourceID) records, err := a.store.Read(resourceID)
if err != nil && err != microstore.ErrNotFound { if err != nil && err != microstore.ErrNotFound {
@@ -269,7 +269,7 @@ func (a *ActivitylogService) addActivity(initRef *provider.Reference, eventID st
return fmt.Errorf("could not get resource info: %w", err) return fmt.Errorf("could not get resource info: %w", err)
} }
if err := a.storeActivity(storagespace.FormatResourceID(*info.GetId()), eventID, depth, timestamp); err != nil { if err := a.storeActivity(storagespace.FormatResourceID(info.GetId()), eventID, depth, timestamp); err != nil {
return fmt.Errorf("could not store activity: %w", err) return fmt.Errorf("could not store activity: %w", err)
} }
+2 -2
View File
@@ -108,7 +108,7 @@ var testCases = []struct {
require.Equal(t, "", ev.ItemType) // not implemented atm require.Equal(t, "", ev.ItemType) // not implemented atm
require.Equal(t, "", ev.ExpirationDate) // no expiration for shares require.Equal(t, "", ev.ExpirationDate) // no expiration for shares
require.Equal(t, false, ev.SharePass) require.Equal(t, false, ev.SharePass)
require.Equal(t, "get_quota:true stat:true ", ev.Permissions) require.Equal(t, "get_quota:true stat:true", ev.Permissions)
require.Equal(t, "group", ev.ShareType) require.Equal(t, "group", ev.ShareType)
require.Equal(t, "beshared-groupid", ev.ShareWith) require.Equal(t, "beshared-groupid", ev.ShareWith)
require.Equal(t, "sharing-userid", ev.ShareOwner) require.Equal(t, "sharing-userid", ev.ShareOwner)
@@ -142,7 +142,7 @@ var testCases = []struct {
require.Equal(t, "", ev.ItemType) // not implemented atm require.Equal(t, "", ev.ItemType) // not implemented atm
require.Equal(t, "2001-09-20T15:33:20Z", ev.ExpirationDate) require.Equal(t, "2001-09-20T15:33:20Z", ev.ExpirationDate)
require.Equal(t, true, ev.SharePass) require.Equal(t, true, ev.SharePass)
require.Equal(t, "stat:true ", ev.Permissions) require.Equal(t, "stat:true", ev.Permissions)
require.Equal(t, "link", ev.ShareType) require.Equal(t, "link", ev.ShareType)
require.Equal(t, "", ev.ShareWith) // not filled on links require.Equal(t, "", ev.ShareWith) // not filled on links
require.Equal(t, "sharing-userid", ev.ShareOwner) require.Equal(t, "sharing-userid", ev.ShareOwner)
+3 -3
View File
@@ -196,8 +196,8 @@ func processFileEvent(ctx context.Context, ref *provider.Reference, gwc gateway.
} }
data := FileEvent{ data := FileEvent{
ParentItemID: storagespace.FormatResourceID(*info.GetParentId()), ParentItemID: storagespace.FormatResourceID(info.GetParentId()),
ItemID: storagespace.FormatResourceID(*info.GetId()), ItemID: storagespace.FormatResourceID(info.GetId()),
SpaceID: storagespace.FormatStorageID(info.GetSpace().GetRoot().GetStorageId(), info.GetSpace().GetRoot().GetSpaceId()), SpaceID: storagespace.FormatStorageID(info.GetSpace().GetRoot().GetStorageId(), info.GetSpace().GetRoot().GetSpaceId()),
InitiatorID: initiatorid, InitiatorID: initiatorid,
Etag: info.GetEtag(), Etag: info.GetEtag(),
@@ -233,7 +233,7 @@ func processItemTrashedEvent(ctx context.Context, ref *provider.Reference, gwc g
if item.GetKey() == itemID.GetOpaqueId() { if item.GetKey() == itemID.GetOpaqueId() {
data := FileEvent{ data := FileEvent{
ItemID: storagespace.FormatResourceID(*itemID), ItemID: storagespace.FormatResourceID(itemID),
// TODO: check with web if parentID is needed // TODO: check with web if parentID is needed
// ParentItemID: storagespace.FormatResourceID(*item.GetRef().GetResourceId()), // ParentItemID: storagespace.FormatResourceID(*item.GetRef().GetResourceId()),
SpaceID: storagespace.FormatStorageID(itemID.GetStorageId(), itemID.GetSpaceId()), SpaceID: storagespace.FormatStorageID(itemID.GetStorageId(), itemID.GetSpaceId()),
@@ -25,7 +25,7 @@ func (_m *DriveItemPermissionsProvider) EXPECT() *DriveItemPermissionsProvider_E
} }
// CreateLink provides a mock function with given fields: ctx, driveItemID, createLink // CreateLink provides a mock function with given fields: ctx, driveItemID, createLink
func (_m *DriveItemPermissionsProvider) CreateLink(ctx context.Context, driveItemID providerv1beta1.ResourceId, createLink libregraph.DriveItemCreateLink) (libregraph.Permission, error) { func (_m *DriveItemPermissionsProvider) CreateLink(ctx context.Context, driveItemID *providerv1beta1.ResourceId, createLink libregraph.DriveItemCreateLink) (libregraph.Permission, error) {
ret := _m.Called(ctx, driveItemID, createLink) ret := _m.Called(ctx, driveItemID, createLink)
if len(ret) == 0 { if len(ret) == 0 {
@@ -34,16 +34,16 @@ func (_m *DriveItemPermissionsProvider) CreateLink(ctx context.Context, driveIte
var r0 libregraph.Permission var r0 libregraph.Permission
var r1 error var r1 error
if rf, ok := ret.Get(0).(func(context.Context, providerv1beta1.ResourceId, libregraph.DriveItemCreateLink) (libregraph.Permission, error)); ok { if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ResourceId, libregraph.DriveItemCreateLink) (libregraph.Permission, error)); ok {
return rf(ctx, driveItemID, createLink) return rf(ctx, driveItemID, createLink)
} }
if rf, ok := ret.Get(0).(func(context.Context, providerv1beta1.ResourceId, libregraph.DriveItemCreateLink) libregraph.Permission); ok { if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ResourceId, libregraph.DriveItemCreateLink) libregraph.Permission); ok {
r0 = rf(ctx, driveItemID, createLink) r0 = rf(ctx, driveItemID, createLink)
} else { } else {
r0 = ret.Get(0).(libregraph.Permission) r0 = ret.Get(0).(libregraph.Permission)
} }
if rf, ok := ret.Get(1).(func(context.Context, providerv1beta1.ResourceId, libregraph.DriveItemCreateLink) error); ok { if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.ResourceId, libregraph.DriveItemCreateLink) error); ok {
r1 = rf(ctx, driveItemID, createLink) r1 = rf(ctx, driveItemID, createLink)
} else { } else {
r1 = ret.Error(1) r1 = ret.Error(1)
@@ -59,15 +59,15 @@ type DriveItemPermissionsProvider_CreateLink_Call struct {
// CreateLink is a helper method to define mock.On call // CreateLink is a helper method to define mock.On call
// - ctx context.Context // - ctx context.Context
// - driveItemID providerv1beta1.ResourceId // - driveItemID *providerv1beta1.ResourceId
// - createLink libregraph.DriveItemCreateLink // - createLink libregraph.DriveItemCreateLink
func (_e *DriveItemPermissionsProvider_Expecter) CreateLink(ctx interface{}, driveItemID interface{}, createLink interface{}) *DriveItemPermissionsProvider_CreateLink_Call { func (_e *DriveItemPermissionsProvider_Expecter) CreateLink(ctx interface{}, driveItemID interface{}, createLink interface{}) *DriveItemPermissionsProvider_CreateLink_Call {
return &DriveItemPermissionsProvider_CreateLink_Call{Call: _e.mock.On("CreateLink", ctx, driveItemID, createLink)} return &DriveItemPermissionsProvider_CreateLink_Call{Call: _e.mock.On("CreateLink", ctx, driveItemID, createLink)}
} }
func (_c *DriveItemPermissionsProvider_CreateLink_Call) Run(run func(ctx context.Context, driveItemID providerv1beta1.ResourceId, createLink libregraph.DriveItemCreateLink)) *DriveItemPermissionsProvider_CreateLink_Call { func (_c *DriveItemPermissionsProvider_CreateLink_Call) Run(run func(ctx context.Context, driveItemID *providerv1beta1.ResourceId, createLink libregraph.DriveItemCreateLink)) *DriveItemPermissionsProvider_CreateLink_Call {
_c.Call.Run(func(args mock.Arguments) { _c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(providerv1beta1.ResourceId), args[2].(libregraph.DriveItemCreateLink)) run(args[0].(context.Context), args[1].(*providerv1beta1.ResourceId), args[2].(libregraph.DriveItemCreateLink))
}) })
return _c return _c
} }
@@ -77,13 +77,13 @@ func (_c *DriveItemPermissionsProvider_CreateLink_Call) Return(_a0 libregraph.Pe
return _c return _c
} }
func (_c *DriveItemPermissionsProvider_CreateLink_Call) RunAndReturn(run func(context.Context, providerv1beta1.ResourceId, libregraph.DriveItemCreateLink) (libregraph.Permission, error)) *DriveItemPermissionsProvider_CreateLink_Call { func (_c *DriveItemPermissionsProvider_CreateLink_Call) RunAndReturn(run func(context.Context, *providerv1beta1.ResourceId, libregraph.DriveItemCreateLink) (libregraph.Permission, error)) *DriveItemPermissionsProvider_CreateLink_Call {
_c.Call.Return(run) _c.Call.Return(run)
return _c return _c
} }
// CreateSpaceRootLink provides a mock function with given fields: ctx, driveID, createLink // CreateSpaceRootLink provides a mock function with given fields: ctx, driveID, createLink
func (_m *DriveItemPermissionsProvider) CreateSpaceRootLink(ctx context.Context, driveID providerv1beta1.ResourceId, createLink libregraph.DriveItemCreateLink) (libregraph.Permission, error) { func (_m *DriveItemPermissionsProvider) CreateSpaceRootLink(ctx context.Context, driveID *providerv1beta1.ResourceId, createLink libregraph.DriveItemCreateLink) (libregraph.Permission, error) {
ret := _m.Called(ctx, driveID, createLink) ret := _m.Called(ctx, driveID, createLink)
if len(ret) == 0 { if len(ret) == 0 {
@@ -92,16 +92,16 @@ func (_m *DriveItemPermissionsProvider) CreateSpaceRootLink(ctx context.Context,
var r0 libregraph.Permission var r0 libregraph.Permission
var r1 error var r1 error
if rf, ok := ret.Get(0).(func(context.Context, providerv1beta1.ResourceId, libregraph.DriveItemCreateLink) (libregraph.Permission, error)); ok { if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ResourceId, libregraph.DriveItemCreateLink) (libregraph.Permission, error)); ok {
return rf(ctx, driveID, createLink) return rf(ctx, driveID, createLink)
} }
if rf, ok := ret.Get(0).(func(context.Context, providerv1beta1.ResourceId, libregraph.DriveItemCreateLink) libregraph.Permission); ok { if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ResourceId, libregraph.DriveItemCreateLink) libregraph.Permission); ok {
r0 = rf(ctx, driveID, createLink) r0 = rf(ctx, driveID, createLink)
} else { } else {
r0 = ret.Get(0).(libregraph.Permission) r0 = ret.Get(0).(libregraph.Permission)
} }
if rf, ok := ret.Get(1).(func(context.Context, providerv1beta1.ResourceId, libregraph.DriveItemCreateLink) error); ok { if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.ResourceId, libregraph.DriveItemCreateLink) error); ok {
r1 = rf(ctx, driveID, createLink) r1 = rf(ctx, driveID, createLink)
} else { } else {
r1 = ret.Error(1) r1 = ret.Error(1)
@@ -117,15 +117,15 @@ type DriveItemPermissionsProvider_CreateSpaceRootLink_Call struct {
// CreateSpaceRootLink is a helper method to define mock.On call // CreateSpaceRootLink is a helper method to define mock.On call
// - ctx context.Context // - ctx context.Context
// - driveID providerv1beta1.ResourceId // - driveID *providerv1beta1.ResourceId
// - createLink libregraph.DriveItemCreateLink // - createLink libregraph.DriveItemCreateLink
func (_e *DriveItemPermissionsProvider_Expecter) CreateSpaceRootLink(ctx interface{}, driveID interface{}, createLink interface{}) *DriveItemPermissionsProvider_CreateSpaceRootLink_Call { func (_e *DriveItemPermissionsProvider_Expecter) CreateSpaceRootLink(ctx interface{}, driveID interface{}, createLink interface{}) *DriveItemPermissionsProvider_CreateSpaceRootLink_Call {
return &DriveItemPermissionsProvider_CreateSpaceRootLink_Call{Call: _e.mock.On("CreateSpaceRootLink", ctx, driveID, createLink)} return &DriveItemPermissionsProvider_CreateSpaceRootLink_Call{Call: _e.mock.On("CreateSpaceRootLink", ctx, driveID, createLink)}
} }
func (_c *DriveItemPermissionsProvider_CreateSpaceRootLink_Call) Run(run func(ctx context.Context, driveID providerv1beta1.ResourceId, createLink libregraph.DriveItemCreateLink)) *DriveItemPermissionsProvider_CreateSpaceRootLink_Call { func (_c *DriveItemPermissionsProvider_CreateSpaceRootLink_Call) Run(run func(ctx context.Context, driveID *providerv1beta1.ResourceId, createLink libregraph.DriveItemCreateLink)) *DriveItemPermissionsProvider_CreateSpaceRootLink_Call {
_c.Call.Run(func(args mock.Arguments) { _c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(providerv1beta1.ResourceId), args[2].(libregraph.DriveItemCreateLink)) run(args[0].(context.Context), args[1].(*providerv1beta1.ResourceId), args[2].(libregraph.DriveItemCreateLink))
}) })
return _c return _c
} }
@@ -135,13 +135,13 @@ func (_c *DriveItemPermissionsProvider_CreateSpaceRootLink_Call) Return(_a0 libr
return _c return _c
} }
func (_c *DriveItemPermissionsProvider_CreateSpaceRootLink_Call) RunAndReturn(run func(context.Context, providerv1beta1.ResourceId, libregraph.DriveItemCreateLink) (libregraph.Permission, error)) *DriveItemPermissionsProvider_CreateSpaceRootLink_Call { func (_c *DriveItemPermissionsProvider_CreateSpaceRootLink_Call) RunAndReturn(run func(context.Context, *providerv1beta1.ResourceId, libregraph.DriveItemCreateLink) (libregraph.Permission, error)) *DriveItemPermissionsProvider_CreateSpaceRootLink_Call {
_c.Call.Return(run) _c.Call.Return(run)
return _c return _c
} }
// DeletePermission provides a mock function with given fields: ctx, itemID, permissionID // DeletePermission provides a mock function with given fields: ctx, itemID, permissionID
func (_m *DriveItemPermissionsProvider) DeletePermission(ctx context.Context, itemID providerv1beta1.ResourceId, permissionID string) error { func (_m *DriveItemPermissionsProvider) DeletePermission(ctx context.Context, itemID *providerv1beta1.ResourceId, permissionID string) error {
ret := _m.Called(ctx, itemID, permissionID) ret := _m.Called(ctx, itemID, permissionID)
if len(ret) == 0 { if len(ret) == 0 {
@@ -149,7 +149,7 @@ func (_m *DriveItemPermissionsProvider) DeletePermission(ctx context.Context, it
} }
var r0 error var r0 error
if rf, ok := ret.Get(0).(func(context.Context, providerv1beta1.ResourceId, string) error); ok { if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ResourceId, string) error); ok {
r0 = rf(ctx, itemID, permissionID) r0 = rf(ctx, itemID, permissionID)
} else { } else {
r0 = ret.Error(0) r0 = ret.Error(0)
@@ -165,15 +165,15 @@ type DriveItemPermissionsProvider_DeletePermission_Call struct {
// DeletePermission is a helper method to define mock.On call // DeletePermission is a helper method to define mock.On call
// - ctx context.Context // - ctx context.Context
// - itemID providerv1beta1.ResourceId // - itemID *providerv1beta1.ResourceId
// - permissionID string // - permissionID string
func (_e *DriveItemPermissionsProvider_Expecter) DeletePermission(ctx interface{}, itemID interface{}, permissionID interface{}) *DriveItemPermissionsProvider_DeletePermission_Call { func (_e *DriveItemPermissionsProvider_Expecter) DeletePermission(ctx interface{}, itemID interface{}, permissionID interface{}) *DriveItemPermissionsProvider_DeletePermission_Call {
return &DriveItemPermissionsProvider_DeletePermission_Call{Call: _e.mock.On("DeletePermission", ctx, itemID, permissionID)} return &DriveItemPermissionsProvider_DeletePermission_Call{Call: _e.mock.On("DeletePermission", ctx, itemID, permissionID)}
} }
func (_c *DriveItemPermissionsProvider_DeletePermission_Call) Run(run func(ctx context.Context, itemID providerv1beta1.ResourceId, permissionID string)) *DriveItemPermissionsProvider_DeletePermission_Call { func (_c *DriveItemPermissionsProvider_DeletePermission_Call) Run(run func(ctx context.Context, itemID *providerv1beta1.ResourceId, permissionID string)) *DriveItemPermissionsProvider_DeletePermission_Call {
_c.Call.Run(func(args mock.Arguments) { _c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(providerv1beta1.ResourceId), args[2].(string)) run(args[0].(context.Context), args[1].(*providerv1beta1.ResourceId), args[2].(string))
}) })
return _c return _c
} }
@@ -183,13 +183,13 @@ func (_c *DriveItemPermissionsProvider_DeletePermission_Call) Return(_a0 error)
return _c return _c
} }
func (_c *DriveItemPermissionsProvider_DeletePermission_Call) RunAndReturn(run func(context.Context, providerv1beta1.ResourceId, string) error) *DriveItemPermissionsProvider_DeletePermission_Call { func (_c *DriveItemPermissionsProvider_DeletePermission_Call) RunAndReturn(run func(context.Context, *providerv1beta1.ResourceId, string) error) *DriveItemPermissionsProvider_DeletePermission_Call {
_c.Call.Return(run) _c.Call.Return(run)
return _c return _c
} }
// DeleteSpaceRootPermission provides a mock function with given fields: ctx, driveID, permissionID // DeleteSpaceRootPermission provides a mock function with given fields: ctx, driveID, permissionID
func (_m *DriveItemPermissionsProvider) DeleteSpaceRootPermission(ctx context.Context, driveID providerv1beta1.ResourceId, permissionID string) error { func (_m *DriveItemPermissionsProvider) DeleteSpaceRootPermission(ctx context.Context, driveID *providerv1beta1.ResourceId, permissionID string) error {
ret := _m.Called(ctx, driveID, permissionID) ret := _m.Called(ctx, driveID, permissionID)
if len(ret) == 0 { if len(ret) == 0 {
@@ -197,7 +197,7 @@ func (_m *DriveItemPermissionsProvider) DeleteSpaceRootPermission(ctx context.Co
} }
var r0 error var r0 error
if rf, ok := ret.Get(0).(func(context.Context, providerv1beta1.ResourceId, string) error); ok { if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ResourceId, string) error); ok {
r0 = rf(ctx, driveID, permissionID) r0 = rf(ctx, driveID, permissionID)
} else { } else {
r0 = ret.Error(0) r0 = ret.Error(0)
@@ -213,15 +213,15 @@ type DriveItemPermissionsProvider_DeleteSpaceRootPermission_Call struct {
// DeleteSpaceRootPermission is a helper method to define mock.On call // DeleteSpaceRootPermission is a helper method to define mock.On call
// - ctx context.Context // - ctx context.Context
// - driveID providerv1beta1.ResourceId // - driveID *providerv1beta1.ResourceId
// - permissionID string // - permissionID string
func (_e *DriveItemPermissionsProvider_Expecter) DeleteSpaceRootPermission(ctx interface{}, driveID interface{}, permissionID interface{}) *DriveItemPermissionsProvider_DeleteSpaceRootPermission_Call { func (_e *DriveItemPermissionsProvider_Expecter) DeleteSpaceRootPermission(ctx interface{}, driveID interface{}, permissionID interface{}) *DriveItemPermissionsProvider_DeleteSpaceRootPermission_Call {
return &DriveItemPermissionsProvider_DeleteSpaceRootPermission_Call{Call: _e.mock.On("DeleteSpaceRootPermission", ctx, driveID, permissionID)} return &DriveItemPermissionsProvider_DeleteSpaceRootPermission_Call{Call: _e.mock.On("DeleteSpaceRootPermission", ctx, driveID, permissionID)}
} }
func (_c *DriveItemPermissionsProvider_DeleteSpaceRootPermission_Call) Run(run func(ctx context.Context, driveID providerv1beta1.ResourceId, permissionID string)) *DriveItemPermissionsProvider_DeleteSpaceRootPermission_Call { func (_c *DriveItemPermissionsProvider_DeleteSpaceRootPermission_Call) Run(run func(ctx context.Context, driveID *providerv1beta1.ResourceId, permissionID string)) *DriveItemPermissionsProvider_DeleteSpaceRootPermission_Call {
_c.Call.Run(func(args mock.Arguments) { _c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(providerv1beta1.ResourceId), args[2].(string)) run(args[0].(context.Context), args[1].(*providerv1beta1.ResourceId), args[2].(string))
}) })
return _c return _c
} }
@@ -231,13 +231,13 @@ func (_c *DriveItemPermissionsProvider_DeleteSpaceRootPermission_Call) Return(_a
return _c return _c
} }
func (_c *DriveItemPermissionsProvider_DeleteSpaceRootPermission_Call) RunAndReturn(run func(context.Context, providerv1beta1.ResourceId, string) error) *DriveItemPermissionsProvider_DeleteSpaceRootPermission_Call { func (_c *DriveItemPermissionsProvider_DeleteSpaceRootPermission_Call) RunAndReturn(run func(context.Context, *providerv1beta1.ResourceId, string) error) *DriveItemPermissionsProvider_DeleteSpaceRootPermission_Call {
_c.Call.Return(run) _c.Call.Return(run)
return _c return _c
} }
// Invite provides a mock function with given fields: ctx, resourceId, invite // Invite provides a mock function with given fields: ctx, resourceId, invite
func (_m *DriveItemPermissionsProvider) Invite(ctx context.Context, resourceId providerv1beta1.ResourceId, invite libregraph.DriveItemInvite) (libregraph.Permission, error) { func (_m *DriveItemPermissionsProvider) Invite(ctx context.Context, resourceId *providerv1beta1.ResourceId, invite libregraph.DriveItemInvite) (libregraph.Permission, error) {
ret := _m.Called(ctx, resourceId, invite) ret := _m.Called(ctx, resourceId, invite)
if len(ret) == 0 { if len(ret) == 0 {
@@ -246,16 +246,16 @@ func (_m *DriveItemPermissionsProvider) Invite(ctx context.Context, resourceId p
var r0 libregraph.Permission var r0 libregraph.Permission
var r1 error var r1 error
if rf, ok := ret.Get(0).(func(context.Context, providerv1beta1.ResourceId, libregraph.DriveItemInvite) (libregraph.Permission, error)); ok { if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ResourceId, libregraph.DriveItemInvite) (libregraph.Permission, error)); ok {
return rf(ctx, resourceId, invite) return rf(ctx, resourceId, invite)
} }
if rf, ok := ret.Get(0).(func(context.Context, providerv1beta1.ResourceId, libregraph.DriveItemInvite) libregraph.Permission); ok { if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ResourceId, libregraph.DriveItemInvite) libregraph.Permission); ok {
r0 = rf(ctx, resourceId, invite) r0 = rf(ctx, resourceId, invite)
} else { } else {
r0 = ret.Get(0).(libregraph.Permission) r0 = ret.Get(0).(libregraph.Permission)
} }
if rf, ok := ret.Get(1).(func(context.Context, providerv1beta1.ResourceId, libregraph.DriveItemInvite) error); ok { if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.ResourceId, libregraph.DriveItemInvite) error); ok {
r1 = rf(ctx, resourceId, invite) r1 = rf(ctx, resourceId, invite)
} else { } else {
r1 = ret.Error(1) r1 = ret.Error(1)
@@ -271,15 +271,15 @@ type DriveItemPermissionsProvider_Invite_Call struct {
// Invite is a helper method to define mock.On call // Invite is a helper method to define mock.On call
// - ctx context.Context // - ctx context.Context
// - resourceId providerv1beta1.ResourceId // - resourceId *providerv1beta1.ResourceId
// - invite libregraph.DriveItemInvite // - invite libregraph.DriveItemInvite
func (_e *DriveItemPermissionsProvider_Expecter) Invite(ctx interface{}, resourceId interface{}, invite interface{}) *DriveItemPermissionsProvider_Invite_Call { func (_e *DriveItemPermissionsProvider_Expecter) Invite(ctx interface{}, resourceId interface{}, invite interface{}) *DriveItemPermissionsProvider_Invite_Call {
return &DriveItemPermissionsProvider_Invite_Call{Call: _e.mock.On("Invite", ctx, resourceId, invite)} return &DriveItemPermissionsProvider_Invite_Call{Call: _e.mock.On("Invite", ctx, resourceId, invite)}
} }
func (_c *DriveItemPermissionsProvider_Invite_Call) Run(run func(ctx context.Context, resourceId providerv1beta1.ResourceId, invite libregraph.DriveItemInvite)) *DriveItemPermissionsProvider_Invite_Call { func (_c *DriveItemPermissionsProvider_Invite_Call) Run(run func(ctx context.Context, resourceId *providerv1beta1.ResourceId, invite libregraph.DriveItemInvite)) *DriveItemPermissionsProvider_Invite_Call {
_c.Call.Run(func(args mock.Arguments) { _c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(providerv1beta1.ResourceId), args[2].(libregraph.DriveItemInvite)) run(args[0].(context.Context), args[1].(*providerv1beta1.ResourceId), args[2].(libregraph.DriveItemInvite))
}) })
return _c return _c
} }
@@ -289,7 +289,7 @@ func (_c *DriveItemPermissionsProvider_Invite_Call) Return(_a0 libregraph.Permis
return _c return _c
} }
func (_c *DriveItemPermissionsProvider_Invite_Call) RunAndReturn(run func(context.Context, providerv1beta1.ResourceId, libregraph.DriveItemInvite) (libregraph.Permission, error)) *DriveItemPermissionsProvider_Invite_Call { func (_c *DriveItemPermissionsProvider_Invite_Call) RunAndReturn(run func(context.Context, *providerv1beta1.ResourceId, libregraph.DriveItemInvite) (libregraph.Permission, error)) *DriveItemPermissionsProvider_Invite_Call {
_c.Call.Return(run) _c.Call.Return(run)
return _c return _c
} }
@@ -352,7 +352,7 @@ func (_c *DriveItemPermissionsProvider_ListPermissions_Call) RunAndReturn(run fu
} }
// ListSpaceRootPermissions provides a mock function with given fields: ctx, driveID // ListSpaceRootPermissions provides a mock function with given fields: ctx, driveID
func (_m *DriveItemPermissionsProvider) ListSpaceRootPermissions(ctx context.Context, driveID providerv1beta1.ResourceId) (libregraph.CollectionOfPermissionsWithAllowedValues, error) { func (_m *DriveItemPermissionsProvider) ListSpaceRootPermissions(ctx context.Context, driveID *providerv1beta1.ResourceId) (libregraph.CollectionOfPermissionsWithAllowedValues, error) {
ret := _m.Called(ctx, driveID) ret := _m.Called(ctx, driveID)
if len(ret) == 0 { if len(ret) == 0 {
@@ -361,16 +361,16 @@ func (_m *DriveItemPermissionsProvider) ListSpaceRootPermissions(ctx context.Con
var r0 libregraph.CollectionOfPermissionsWithAllowedValues var r0 libregraph.CollectionOfPermissionsWithAllowedValues
var r1 error var r1 error
if rf, ok := ret.Get(0).(func(context.Context, providerv1beta1.ResourceId) (libregraph.CollectionOfPermissionsWithAllowedValues, error)); ok { if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ResourceId) (libregraph.CollectionOfPermissionsWithAllowedValues, error)); ok {
return rf(ctx, driveID) return rf(ctx, driveID)
} }
if rf, ok := ret.Get(0).(func(context.Context, providerv1beta1.ResourceId) libregraph.CollectionOfPermissionsWithAllowedValues); ok { if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ResourceId) libregraph.CollectionOfPermissionsWithAllowedValues); ok {
r0 = rf(ctx, driveID) r0 = rf(ctx, driveID)
} else { } else {
r0 = ret.Get(0).(libregraph.CollectionOfPermissionsWithAllowedValues) r0 = ret.Get(0).(libregraph.CollectionOfPermissionsWithAllowedValues)
} }
if rf, ok := ret.Get(1).(func(context.Context, providerv1beta1.ResourceId) error); ok { if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.ResourceId) error); ok {
r1 = rf(ctx, driveID) r1 = rf(ctx, driveID)
} else { } else {
r1 = ret.Error(1) r1 = ret.Error(1)
@@ -386,14 +386,14 @@ type DriveItemPermissionsProvider_ListSpaceRootPermissions_Call struct {
// ListSpaceRootPermissions is a helper method to define mock.On call // ListSpaceRootPermissions is a helper method to define mock.On call
// - ctx context.Context // - ctx context.Context
// - driveID providerv1beta1.ResourceId // - driveID *providerv1beta1.ResourceId
func (_e *DriveItemPermissionsProvider_Expecter) ListSpaceRootPermissions(ctx interface{}, driveID interface{}) *DriveItemPermissionsProvider_ListSpaceRootPermissions_Call { func (_e *DriveItemPermissionsProvider_Expecter) ListSpaceRootPermissions(ctx interface{}, driveID interface{}) *DriveItemPermissionsProvider_ListSpaceRootPermissions_Call {
return &DriveItemPermissionsProvider_ListSpaceRootPermissions_Call{Call: _e.mock.On("ListSpaceRootPermissions", ctx, driveID)} return &DriveItemPermissionsProvider_ListSpaceRootPermissions_Call{Call: _e.mock.On("ListSpaceRootPermissions", ctx, driveID)}
} }
func (_c *DriveItemPermissionsProvider_ListSpaceRootPermissions_Call) Run(run func(ctx context.Context, driveID providerv1beta1.ResourceId)) *DriveItemPermissionsProvider_ListSpaceRootPermissions_Call { func (_c *DriveItemPermissionsProvider_ListSpaceRootPermissions_Call) Run(run func(ctx context.Context, driveID *providerv1beta1.ResourceId)) *DriveItemPermissionsProvider_ListSpaceRootPermissions_Call {
_c.Call.Run(func(args mock.Arguments) { _c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(providerv1beta1.ResourceId)) run(args[0].(context.Context), args[1].(*providerv1beta1.ResourceId))
}) })
return _c return _c
} }
@@ -403,13 +403,13 @@ func (_c *DriveItemPermissionsProvider_ListSpaceRootPermissions_Call) Return(_a0
return _c return _c
} }
func (_c *DriveItemPermissionsProvider_ListSpaceRootPermissions_Call) RunAndReturn(run func(context.Context, providerv1beta1.ResourceId) (libregraph.CollectionOfPermissionsWithAllowedValues, error)) *DriveItemPermissionsProvider_ListSpaceRootPermissions_Call { func (_c *DriveItemPermissionsProvider_ListSpaceRootPermissions_Call) RunAndReturn(run func(context.Context, *providerv1beta1.ResourceId) (libregraph.CollectionOfPermissionsWithAllowedValues, error)) *DriveItemPermissionsProvider_ListSpaceRootPermissions_Call {
_c.Call.Return(run) _c.Call.Return(run)
return _c return _c
} }
// SetPublicLinkPassword provides a mock function with given fields: ctx, driveItemID, permissionID, password // SetPublicLinkPassword provides a mock function with given fields: ctx, driveItemID, permissionID, password
func (_m *DriveItemPermissionsProvider) SetPublicLinkPassword(ctx context.Context, driveItemID providerv1beta1.ResourceId, permissionID string, password string) (libregraph.Permission, error) { func (_m *DriveItemPermissionsProvider) SetPublicLinkPassword(ctx context.Context, driveItemID *providerv1beta1.ResourceId, permissionID string, password string) (libregraph.Permission, error) {
ret := _m.Called(ctx, driveItemID, permissionID, password) ret := _m.Called(ctx, driveItemID, permissionID, password)
if len(ret) == 0 { if len(ret) == 0 {
@@ -418,16 +418,16 @@ func (_m *DriveItemPermissionsProvider) SetPublicLinkPassword(ctx context.Contex
var r0 libregraph.Permission var r0 libregraph.Permission
var r1 error var r1 error
if rf, ok := ret.Get(0).(func(context.Context, providerv1beta1.ResourceId, string, string) (libregraph.Permission, error)); ok { if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ResourceId, string, string) (libregraph.Permission, error)); ok {
return rf(ctx, driveItemID, permissionID, password) return rf(ctx, driveItemID, permissionID, password)
} }
if rf, ok := ret.Get(0).(func(context.Context, providerv1beta1.ResourceId, string, string) libregraph.Permission); ok { if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ResourceId, string, string) libregraph.Permission); ok {
r0 = rf(ctx, driveItemID, permissionID, password) r0 = rf(ctx, driveItemID, permissionID, password)
} else { } else {
r0 = ret.Get(0).(libregraph.Permission) r0 = ret.Get(0).(libregraph.Permission)
} }
if rf, ok := ret.Get(1).(func(context.Context, providerv1beta1.ResourceId, string, string) error); ok { if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.ResourceId, string, string) error); ok {
r1 = rf(ctx, driveItemID, permissionID, password) r1 = rf(ctx, driveItemID, permissionID, password)
} else { } else {
r1 = ret.Error(1) r1 = ret.Error(1)
@@ -443,16 +443,16 @@ type DriveItemPermissionsProvider_SetPublicLinkPassword_Call struct {
// SetPublicLinkPassword is a helper method to define mock.On call // SetPublicLinkPassword is a helper method to define mock.On call
// - ctx context.Context // - ctx context.Context
// - driveItemID providerv1beta1.ResourceId // - driveItemID *providerv1beta1.ResourceId
// - permissionID string // - permissionID string
// - password string // - password string
func (_e *DriveItemPermissionsProvider_Expecter) SetPublicLinkPassword(ctx interface{}, driveItemID interface{}, permissionID interface{}, password interface{}) *DriveItemPermissionsProvider_SetPublicLinkPassword_Call { func (_e *DriveItemPermissionsProvider_Expecter) SetPublicLinkPassword(ctx interface{}, driveItemID interface{}, permissionID interface{}, password interface{}) *DriveItemPermissionsProvider_SetPublicLinkPassword_Call {
return &DriveItemPermissionsProvider_SetPublicLinkPassword_Call{Call: _e.mock.On("SetPublicLinkPassword", ctx, driveItemID, permissionID, password)} return &DriveItemPermissionsProvider_SetPublicLinkPassword_Call{Call: _e.mock.On("SetPublicLinkPassword", ctx, driveItemID, permissionID, password)}
} }
func (_c *DriveItemPermissionsProvider_SetPublicLinkPassword_Call) Run(run func(ctx context.Context, driveItemID providerv1beta1.ResourceId, permissionID string, password string)) *DriveItemPermissionsProvider_SetPublicLinkPassword_Call { func (_c *DriveItemPermissionsProvider_SetPublicLinkPassword_Call) Run(run func(ctx context.Context, driveItemID *providerv1beta1.ResourceId, permissionID string, password string)) *DriveItemPermissionsProvider_SetPublicLinkPassword_Call {
_c.Call.Run(func(args mock.Arguments) { _c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(providerv1beta1.ResourceId), args[2].(string), args[3].(string)) run(args[0].(context.Context), args[1].(*providerv1beta1.ResourceId), args[2].(string), args[3].(string))
}) })
return _c return _c
} }
@@ -462,13 +462,13 @@ func (_c *DriveItemPermissionsProvider_SetPublicLinkPassword_Call) Return(_a0 li
return _c return _c
} }
func (_c *DriveItemPermissionsProvider_SetPublicLinkPassword_Call) RunAndReturn(run func(context.Context, providerv1beta1.ResourceId, string, string) (libregraph.Permission, error)) *DriveItemPermissionsProvider_SetPublicLinkPassword_Call { func (_c *DriveItemPermissionsProvider_SetPublicLinkPassword_Call) RunAndReturn(run func(context.Context, *providerv1beta1.ResourceId, string, string) (libregraph.Permission, error)) *DriveItemPermissionsProvider_SetPublicLinkPassword_Call {
_c.Call.Return(run) _c.Call.Return(run)
return _c return _c
} }
// SetPublicLinkPasswordOnSpaceRoot provides a mock function with given fields: ctx, driveID, permissionID, password // SetPublicLinkPasswordOnSpaceRoot provides a mock function with given fields: ctx, driveID, permissionID, password
func (_m *DriveItemPermissionsProvider) SetPublicLinkPasswordOnSpaceRoot(ctx context.Context, driveID providerv1beta1.ResourceId, permissionID string, password string) (libregraph.Permission, error) { func (_m *DriveItemPermissionsProvider) SetPublicLinkPasswordOnSpaceRoot(ctx context.Context, driveID *providerv1beta1.ResourceId, permissionID string, password string) (libregraph.Permission, error) {
ret := _m.Called(ctx, driveID, permissionID, password) ret := _m.Called(ctx, driveID, permissionID, password)
if len(ret) == 0 { if len(ret) == 0 {
@@ -477,16 +477,16 @@ func (_m *DriveItemPermissionsProvider) SetPublicLinkPasswordOnSpaceRoot(ctx con
var r0 libregraph.Permission var r0 libregraph.Permission
var r1 error var r1 error
if rf, ok := ret.Get(0).(func(context.Context, providerv1beta1.ResourceId, string, string) (libregraph.Permission, error)); ok { if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ResourceId, string, string) (libregraph.Permission, error)); ok {
return rf(ctx, driveID, permissionID, password) return rf(ctx, driveID, permissionID, password)
} }
if rf, ok := ret.Get(0).(func(context.Context, providerv1beta1.ResourceId, string, string) libregraph.Permission); ok { if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ResourceId, string, string) libregraph.Permission); ok {
r0 = rf(ctx, driveID, permissionID, password) r0 = rf(ctx, driveID, permissionID, password)
} else { } else {
r0 = ret.Get(0).(libregraph.Permission) r0 = ret.Get(0).(libregraph.Permission)
} }
if rf, ok := ret.Get(1).(func(context.Context, providerv1beta1.ResourceId, string, string) error); ok { if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.ResourceId, string, string) error); ok {
r1 = rf(ctx, driveID, permissionID, password) r1 = rf(ctx, driveID, permissionID, password)
} else { } else {
r1 = ret.Error(1) r1 = ret.Error(1)
@@ -502,16 +502,16 @@ type DriveItemPermissionsProvider_SetPublicLinkPasswordOnSpaceRoot_Call struct {
// SetPublicLinkPasswordOnSpaceRoot is a helper method to define mock.On call // SetPublicLinkPasswordOnSpaceRoot is a helper method to define mock.On call
// - ctx context.Context // - ctx context.Context
// - driveID providerv1beta1.ResourceId // - driveID *providerv1beta1.ResourceId
// - permissionID string // - permissionID string
// - password string // - password string
func (_e *DriveItemPermissionsProvider_Expecter) SetPublicLinkPasswordOnSpaceRoot(ctx interface{}, driveID interface{}, permissionID interface{}, password interface{}) *DriveItemPermissionsProvider_SetPublicLinkPasswordOnSpaceRoot_Call { func (_e *DriveItemPermissionsProvider_Expecter) SetPublicLinkPasswordOnSpaceRoot(ctx interface{}, driveID interface{}, permissionID interface{}, password interface{}) *DriveItemPermissionsProvider_SetPublicLinkPasswordOnSpaceRoot_Call {
return &DriveItemPermissionsProvider_SetPublicLinkPasswordOnSpaceRoot_Call{Call: _e.mock.On("SetPublicLinkPasswordOnSpaceRoot", ctx, driveID, permissionID, password)} return &DriveItemPermissionsProvider_SetPublicLinkPasswordOnSpaceRoot_Call{Call: _e.mock.On("SetPublicLinkPasswordOnSpaceRoot", ctx, driveID, permissionID, password)}
} }
func (_c *DriveItemPermissionsProvider_SetPublicLinkPasswordOnSpaceRoot_Call) Run(run func(ctx context.Context, driveID providerv1beta1.ResourceId, permissionID string, password string)) *DriveItemPermissionsProvider_SetPublicLinkPasswordOnSpaceRoot_Call { func (_c *DriveItemPermissionsProvider_SetPublicLinkPasswordOnSpaceRoot_Call) Run(run func(ctx context.Context, driveID *providerv1beta1.ResourceId, permissionID string, password string)) *DriveItemPermissionsProvider_SetPublicLinkPasswordOnSpaceRoot_Call {
_c.Call.Run(func(args mock.Arguments) { _c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(providerv1beta1.ResourceId), args[2].(string), args[3].(string)) run(args[0].(context.Context), args[1].(*providerv1beta1.ResourceId), args[2].(string), args[3].(string))
}) })
return _c return _c
} }
@@ -521,13 +521,13 @@ func (_c *DriveItemPermissionsProvider_SetPublicLinkPasswordOnSpaceRoot_Call) Re
return _c return _c
} }
func (_c *DriveItemPermissionsProvider_SetPublicLinkPasswordOnSpaceRoot_Call) RunAndReturn(run func(context.Context, providerv1beta1.ResourceId, string, string) (libregraph.Permission, error)) *DriveItemPermissionsProvider_SetPublicLinkPasswordOnSpaceRoot_Call { func (_c *DriveItemPermissionsProvider_SetPublicLinkPasswordOnSpaceRoot_Call) RunAndReturn(run func(context.Context, *providerv1beta1.ResourceId, string, string) (libregraph.Permission, error)) *DriveItemPermissionsProvider_SetPublicLinkPasswordOnSpaceRoot_Call {
_c.Call.Return(run) _c.Call.Return(run)
return _c return _c
} }
// SpaceRootInvite provides a mock function with given fields: ctx, driveID, invite // SpaceRootInvite provides a mock function with given fields: ctx, driveID, invite
func (_m *DriveItemPermissionsProvider) SpaceRootInvite(ctx context.Context, driveID providerv1beta1.ResourceId, invite libregraph.DriveItemInvite) (libregraph.Permission, error) { func (_m *DriveItemPermissionsProvider) SpaceRootInvite(ctx context.Context, driveID *providerv1beta1.ResourceId, invite libregraph.DriveItemInvite) (libregraph.Permission, error) {
ret := _m.Called(ctx, driveID, invite) ret := _m.Called(ctx, driveID, invite)
if len(ret) == 0 { if len(ret) == 0 {
@@ -536,16 +536,16 @@ func (_m *DriveItemPermissionsProvider) SpaceRootInvite(ctx context.Context, dri
var r0 libregraph.Permission var r0 libregraph.Permission
var r1 error var r1 error
if rf, ok := ret.Get(0).(func(context.Context, providerv1beta1.ResourceId, libregraph.DriveItemInvite) (libregraph.Permission, error)); ok { if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ResourceId, libregraph.DriveItemInvite) (libregraph.Permission, error)); ok {
return rf(ctx, driveID, invite) return rf(ctx, driveID, invite)
} }
if rf, ok := ret.Get(0).(func(context.Context, providerv1beta1.ResourceId, libregraph.DriveItemInvite) libregraph.Permission); ok { if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ResourceId, libregraph.DriveItemInvite) libregraph.Permission); ok {
r0 = rf(ctx, driveID, invite) r0 = rf(ctx, driveID, invite)
} else { } else {
r0 = ret.Get(0).(libregraph.Permission) r0 = ret.Get(0).(libregraph.Permission)
} }
if rf, ok := ret.Get(1).(func(context.Context, providerv1beta1.ResourceId, libregraph.DriveItemInvite) error); ok { if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.ResourceId, libregraph.DriveItemInvite) error); ok {
r1 = rf(ctx, driveID, invite) r1 = rf(ctx, driveID, invite)
} else { } else {
r1 = ret.Error(1) r1 = ret.Error(1)
@@ -561,15 +561,15 @@ type DriveItemPermissionsProvider_SpaceRootInvite_Call struct {
// SpaceRootInvite is a helper method to define mock.On call // SpaceRootInvite is a helper method to define mock.On call
// - ctx context.Context // - ctx context.Context
// - driveID providerv1beta1.ResourceId // - driveID *providerv1beta1.ResourceId
// - invite libregraph.DriveItemInvite // - invite libregraph.DriveItemInvite
func (_e *DriveItemPermissionsProvider_Expecter) SpaceRootInvite(ctx interface{}, driveID interface{}, invite interface{}) *DriveItemPermissionsProvider_SpaceRootInvite_Call { func (_e *DriveItemPermissionsProvider_Expecter) SpaceRootInvite(ctx interface{}, driveID interface{}, invite interface{}) *DriveItemPermissionsProvider_SpaceRootInvite_Call {
return &DriveItemPermissionsProvider_SpaceRootInvite_Call{Call: _e.mock.On("SpaceRootInvite", ctx, driveID, invite)} return &DriveItemPermissionsProvider_SpaceRootInvite_Call{Call: _e.mock.On("SpaceRootInvite", ctx, driveID, invite)}
} }
func (_c *DriveItemPermissionsProvider_SpaceRootInvite_Call) Run(run func(ctx context.Context, driveID providerv1beta1.ResourceId, invite libregraph.DriveItemInvite)) *DriveItemPermissionsProvider_SpaceRootInvite_Call { func (_c *DriveItemPermissionsProvider_SpaceRootInvite_Call) Run(run func(ctx context.Context, driveID *providerv1beta1.ResourceId, invite libregraph.DriveItemInvite)) *DriveItemPermissionsProvider_SpaceRootInvite_Call {
_c.Call.Run(func(args mock.Arguments) { _c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(providerv1beta1.ResourceId), args[2].(libregraph.DriveItemInvite)) run(args[0].(context.Context), args[1].(*providerv1beta1.ResourceId), args[2].(libregraph.DriveItemInvite))
}) })
return _c return _c
} }
@@ -579,13 +579,13 @@ func (_c *DriveItemPermissionsProvider_SpaceRootInvite_Call) Return(_a0 libregra
return _c return _c
} }
func (_c *DriveItemPermissionsProvider_SpaceRootInvite_Call) RunAndReturn(run func(context.Context, providerv1beta1.ResourceId, libregraph.DriveItemInvite) (libregraph.Permission, error)) *DriveItemPermissionsProvider_SpaceRootInvite_Call { func (_c *DriveItemPermissionsProvider_SpaceRootInvite_Call) RunAndReturn(run func(context.Context, *providerv1beta1.ResourceId, libregraph.DriveItemInvite) (libregraph.Permission, error)) *DriveItemPermissionsProvider_SpaceRootInvite_Call {
_c.Call.Return(run) _c.Call.Return(run)
return _c return _c
} }
// UpdatePermission provides a mock function with given fields: ctx, itemID, permissionID, newPermission // UpdatePermission provides a mock function with given fields: ctx, itemID, permissionID, newPermission
func (_m *DriveItemPermissionsProvider) UpdatePermission(ctx context.Context, itemID providerv1beta1.ResourceId, permissionID string, newPermission libregraph.Permission) (libregraph.Permission, error) { func (_m *DriveItemPermissionsProvider) UpdatePermission(ctx context.Context, itemID *providerv1beta1.ResourceId, permissionID string, newPermission libregraph.Permission) (libregraph.Permission, error) {
ret := _m.Called(ctx, itemID, permissionID, newPermission) ret := _m.Called(ctx, itemID, permissionID, newPermission)
if len(ret) == 0 { if len(ret) == 0 {
@@ -594,16 +594,16 @@ func (_m *DriveItemPermissionsProvider) UpdatePermission(ctx context.Context, it
var r0 libregraph.Permission var r0 libregraph.Permission
var r1 error var r1 error
if rf, ok := ret.Get(0).(func(context.Context, providerv1beta1.ResourceId, string, libregraph.Permission) (libregraph.Permission, error)); ok { if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ResourceId, string, libregraph.Permission) (libregraph.Permission, error)); ok {
return rf(ctx, itemID, permissionID, newPermission) return rf(ctx, itemID, permissionID, newPermission)
} }
if rf, ok := ret.Get(0).(func(context.Context, providerv1beta1.ResourceId, string, libregraph.Permission) libregraph.Permission); ok { if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ResourceId, string, libregraph.Permission) libregraph.Permission); ok {
r0 = rf(ctx, itemID, permissionID, newPermission) r0 = rf(ctx, itemID, permissionID, newPermission)
} else { } else {
r0 = ret.Get(0).(libregraph.Permission) r0 = ret.Get(0).(libregraph.Permission)
} }
if rf, ok := ret.Get(1).(func(context.Context, providerv1beta1.ResourceId, string, libregraph.Permission) error); ok { if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.ResourceId, string, libregraph.Permission) error); ok {
r1 = rf(ctx, itemID, permissionID, newPermission) r1 = rf(ctx, itemID, permissionID, newPermission)
} else { } else {
r1 = ret.Error(1) r1 = ret.Error(1)
@@ -619,16 +619,16 @@ type DriveItemPermissionsProvider_UpdatePermission_Call struct {
// UpdatePermission is a helper method to define mock.On call // UpdatePermission is a helper method to define mock.On call
// - ctx context.Context // - ctx context.Context
// - itemID providerv1beta1.ResourceId // - itemID *providerv1beta1.ResourceId
// - permissionID string // - permissionID string
// - newPermission libregraph.Permission // - newPermission libregraph.Permission
func (_e *DriveItemPermissionsProvider_Expecter) UpdatePermission(ctx interface{}, itemID interface{}, permissionID interface{}, newPermission interface{}) *DriveItemPermissionsProvider_UpdatePermission_Call { func (_e *DriveItemPermissionsProvider_Expecter) UpdatePermission(ctx interface{}, itemID interface{}, permissionID interface{}, newPermission interface{}) *DriveItemPermissionsProvider_UpdatePermission_Call {
return &DriveItemPermissionsProvider_UpdatePermission_Call{Call: _e.mock.On("UpdatePermission", ctx, itemID, permissionID, newPermission)} return &DriveItemPermissionsProvider_UpdatePermission_Call{Call: _e.mock.On("UpdatePermission", ctx, itemID, permissionID, newPermission)}
} }
func (_c *DriveItemPermissionsProvider_UpdatePermission_Call) Run(run func(ctx context.Context, itemID providerv1beta1.ResourceId, permissionID string, newPermission libregraph.Permission)) *DriveItemPermissionsProvider_UpdatePermission_Call { func (_c *DriveItemPermissionsProvider_UpdatePermission_Call) Run(run func(ctx context.Context, itemID *providerv1beta1.ResourceId, permissionID string, newPermission libregraph.Permission)) *DriveItemPermissionsProvider_UpdatePermission_Call {
_c.Call.Run(func(args mock.Arguments) { _c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(providerv1beta1.ResourceId), args[2].(string), args[3].(libregraph.Permission)) run(args[0].(context.Context), args[1].(*providerv1beta1.ResourceId), args[2].(string), args[3].(libregraph.Permission))
}) })
return _c return _c
} }
@@ -638,13 +638,13 @@ func (_c *DriveItemPermissionsProvider_UpdatePermission_Call) Return(_a0 libregr
return _c return _c
} }
func (_c *DriveItemPermissionsProvider_UpdatePermission_Call) RunAndReturn(run func(context.Context, providerv1beta1.ResourceId, string, libregraph.Permission) (libregraph.Permission, error)) *DriveItemPermissionsProvider_UpdatePermission_Call { func (_c *DriveItemPermissionsProvider_UpdatePermission_Call) RunAndReturn(run func(context.Context, *providerv1beta1.ResourceId, string, libregraph.Permission) (libregraph.Permission, error)) *DriveItemPermissionsProvider_UpdatePermission_Call {
_c.Call.Return(run) _c.Call.Return(run)
return _c return _c
} }
// UpdateSpaceRootPermission provides a mock function with given fields: ctx, driveID, permissionID, newPermission // UpdateSpaceRootPermission provides a mock function with given fields: ctx, driveID, permissionID, newPermission
func (_m *DriveItemPermissionsProvider) UpdateSpaceRootPermission(ctx context.Context, driveID providerv1beta1.ResourceId, permissionID string, newPermission libregraph.Permission) (libregraph.Permission, error) { func (_m *DriveItemPermissionsProvider) UpdateSpaceRootPermission(ctx context.Context, driveID *providerv1beta1.ResourceId, permissionID string, newPermission libregraph.Permission) (libregraph.Permission, error) {
ret := _m.Called(ctx, driveID, permissionID, newPermission) ret := _m.Called(ctx, driveID, permissionID, newPermission)
if len(ret) == 0 { if len(ret) == 0 {
@@ -653,16 +653,16 @@ func (_m *DriveItemPermissionsProvider) UpdateSpaceRootPermission(ctx context.Co
var r0 libregraph.Permission var r0 libregraph.Permission
var r1 error var r1 error
if rf, ok := ret.Get(0).(func(context.Context, providerv1beta1.ResourceId, string, libregraph.Permission) (libregraph.Permission, error)); ok { if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ResourceId, string, libregraph.Permission) (libregraph.Permission, error)); ok {
return rf(ctx, driveID, permissionID, newPermission) return rf(ctx, driveID, permissionID, newPermission)
} }
if rf, ok := ret.Get(0).(func(context.Context, providerv1beta1.ResourceId, string, libregraph.Permission) libregraph.Permission); ok { if rf, ok := ret.Get(0).(func(context.Context, *providerv1beta1.ResourceId, string, libregraph.Permission) libregraph.Permission); ok {
r0 = rf(ctx, driveID, permissionID, newPermission) r0 = rf(ctx, driveID, permissionID, newPermission)
} else { } else {
r0 = ret.Get(0).(libregraph.Permission) r0 = ret.Get(0).(libregraph.Permission)
} }
if rf, ok := ret.Get(1).(func(context.Context, providerv1beta1.ResourceId, string, libregraph.Permission) error); ok { if rf, ok := ret.Get(1).(func(context.Context, *providerv1beta1.ResourceId, string, libregraph.Permission) error); ok {
r1 = rf(ctx, driveID, permissionID, newPermission) r1 = rf(ctx, driveID, permissionID, newPermission)
} else { } else {
r1 = ret.Error(1) r1 = ret.Error(1)
@@ -678,16 +678,16 @@ type DriveItemPermissionsProvider_UpdateSpaceRootPermission_Call struct {
// UpdateSpaceRootPermission is a helper method to define mock.On call // UpdateSpaceRootPermission is a helper method to define mock.On call
// - ctx context.Context // - ctx context.Context
// - driveID providerv1beta1.ResourceId // - driveID *providerv1beta1.ResourceId
// - permissionID string // - permissionID string
// - newPermission libregraph.Permission // - newPermission libregraph.Permission
func (_e *DriveItemPermissionsProvider_Expecter) UpdateSpaceRootPermission(ctx interface{}, driveID interface{}, permissionID interface{}, newPermission interface{}) *DriveItemPermissionsProvider_UpdateSpaceRootPermission_Call { func (_e *DriveItemPermissionsProvider_Expecter) UpdateSpaceRootPermission(ctx interface{}, driveID interface{}, permissionID interface{}, newPermission interface{}) *DriveItemPermissionsProvider_UpdateSpaceRootPermission_Call {
return &DriveItemPermissionsProvider_UpdateSpaceRootPermission_Call{Call: _e.mock.On("UpdateSpaceRootPermission", ctx, driveID, permissionID, newPermission)} return &DriveItemPermissionsProvider_UpdateSpaceRootPermission_Call{Call: _e.mock.On("UpdateSpaceRootPermission", ctx, driveID, permissionID, newPermission)}
} }
func (_c *DriveItemPermissionsProvider_UpdateSpaceRootPermission_Call) Run(run func(ctx context.Context, driveID providerv1beta1.ResourceId, permissionID string, newPermission libregraph.Permission)) *DriveItemPermissionsProvider_UpdateSpaceRootPermission_Call { func (_c *DriveItemPermissionsProvider_UpdateSpaceRootPermission_Call) Run(run func(ctx context.Context, driveID *providerv1beta1.ResourceId, permissionID string, newPermission libregraph.Permission)) *DriveItemPermissionsProvider_UpdateSpaceRootPermission_Call {
_c.Call.Run(func(args mock.Arguments) { _c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(providerv1beta1.ResourceId), args[2].(string), args[3].(libregraph.Permission)) run(args[0].(context.Context), args[1].(*providerv1beta1.ResourceId), args[2].(string), args[3].(libregraph.Permission))
}) })
return _c return _c
} }
@@ -697,7 +697,7 @@ func (_c *DriveItemPermissionsProvider_UpdateSpaceRootPermission_Call) Return(_a
return _c return _c
} }
func (_c *DriveItemPermissionsProvider_UpdateSpaceRootPermission_Call) RunAndReturn(run func(context.Context, providerv1beta1.ResourceId, string, libregraph.Permission) (libregraph.Permission, error)) *DriveItemPermissionsProvider_UpdateSpaceRootPermission_Call { func (_c *DriveItemPermissionsProvider_UpdateSpaceRootPermission_Call) RunAndReturn(run func(context.Context, *providerv1beta1.ResourceId, string, libregraph.Permission) (libregraph.Permission, error)) *DriveItemPermissionsProvider_UpdateSpaceRootPermission_Call {
_c.Call.Return(run) _c.Call.Return(run)
return _c return _c
} }
@@ -41,18 +41,18 @@ const (
// DriveItemPermissionsProvider contains the methods related to handling permissions on drive items // DriveItemPermissionsProvider contains the methods related to handling permissions on drive items
type DriveItemPermissionsProvider interface { type DriveItemPermissionsProvider interface {
Invite(ctx context.Context, resourceId storageprovider.ResourceId, invite libregraph.DriveItemInvite) (libregraph.Permission, error) Invite(ctx context.Context, resourceId *storageprovider.ResourceId, invite libregraph.DriveItemInvite) (libregraph.Permission, error)
SpaceRootInvite(ctx context.Context, driveID storageprovider.ResourceId, invite libregraph.DriveItemInvite) (libregraph.Permission, error) SpaceRootInvite(ctx context.Context, driveID *storageprovider.ResourceId, invite libregraph.DriveItemInvite) (libregraph.Permission, error)
ListPermissions(ctx context.Context, itemID storageprovider.ResourceId) (libregraph.CollectionOfPermissionsWithAllowedValues, error) ListPermissions(ctx context.Context, itemID storageprovider.ResourceId) (libregraph.CollectionOfPermissionsWithAllowedValues, error)
ListSpaceRootPermissions(ctx context.Context, driveID storageprovider.ResourceId) (libregraph.CollectionOfPermissionsWithAllowedValues, error) ListSpaceRootPermissions(ctx context.Context, driveID *storageprovider.ResourceId) (libregraph.CollectionOfPermissionsWithAllowedValues, error)
DeletePermission(ctx context.Context, itemID storageprovider.ResourceId, permissionID string) error DeletePermission(ctx context.Context, itemID *storageprovider.ResourceId, permissionID string) error
DeleteSpaceRootPermission(ctx context.Context, driveID storageprovider.ResourceId, permissionID string) error DeleteSpaceRootPermission(ctx context.Context, driveID *storageprovider.ResourceId, permissionID string) error
UpdatePermission(ctx context.Context, itemID storageprovider.ResourceId, permissionID string, newPermission libregraph.Permission) (libregraph.Permission, error) UpdatePermission(ctx context.Context, itemID *storageprovider.ResourceId, permissionID string, newPermission libregraph.Permission) (libregraph.Permission, error)
UpdateSpaceRootPermission(ctx context.Context, driveID storageprovider.ResourceId, permissionID string, newPermission libregraph.Permission) (libregraph.Permission, error) UpdateSpaceRootPermission(ctx context.Context, driveID *storageprovider.ResourceId, permissionID string, newPermission libregraph.Permission) (libregraph.Permission, error)
CreateLink(ctx context.Context, driveItemID storageprovider.ResourceId, createLink libregraph.DriveItemCreateLink) (libregraph.Permission, error) CreateLink(ctx context.Context, driveItemID *storageprovider.ResourceId, createLink libregraph.DriveItemCreateLink) (libregraph.Permission, error)
CreateSpaceRootLink(ctx context.Context, driveID storageprovider.ResourceId, createLink libregraph.DriveItemCreateLink) (libregraph.Permission, error) CreateSpaceRootLink(ctx context.Context, driveID *storageprovider.ResourceId, createLink libregraph.DriveItemCreateLink) (libregraph.Permission, error)
SetPublicLinkPassword(ctx context.Context, driveItemID storageprovider.ResourceId, permissionID string, password string) (libregraph.Permission, error) SetPublicLinkPassword(ctx context.Context, driveItemID *storageprovider.ResourceId, permissionID string, password string) (libregraph.Permission, error)
SetPublicLinkPasswordOnSpaceRoot(ctx context.Context, driveID storageprovider.ResourceId, permissionID string, password string) (libregraph.Permission, error) SetPublicLinkPasswordOnSpaceRoot(ctx context.Context, driveID *storageprovider.ResourceId, permissionID string, password string) (libregraph.Permission, error)
} }
// DriveItemPermissionsService contains the production business logic for everything that relates to permissions on drive items. // DriveItemPermissionsService contains the production business logic for everything that relates to permissions on drive items.
@@ -82,13 +82,13 @@ func NewDriveItemPermissionsService(logger log.Logger, gatewaySelector pool.Sele
} }
// Invite invites a user to a drive item. // Invite invites a user to a drive item.
func (s DriveItemPermissionsService) Invite(ctx context.Context, resourceId storageprovider.ResourceId, invite libregraph.DriveItemInvite) (libregraph.Permission, error) { func (s DriveItemPermissionsService) Invite(ctx context.Context, resourceId *storageprovider.ResourceId, invite libregraph.DriveItemInvite) (libregraph.Permission, error) {
gatewayClient, err := s.gatewaySelector.Next() gatewayClient, err := s.gatewaySelector.Next()
if err != nil { if err != nil {
return libregraph.Permission{}, err return libregraph.Permission{}, err
} }
statResponse, err := gatewayClient.Stat(ctx, &storageprovider.StatRequest{Ref: &storageprovider.Reference{ResourceId: &resourceId}}) statResponse, err := gatewayClient.Stat(ctx, &storageprovider.StatRequest{Ref: &storageprovider.Reference{ResourceId: resourceId}})
if err := errorcode.FromStat(statResponse, err); err != nil { if err := errorcode.FromStat(statResponse, err); err != nil {
s.logger.Warn().Err(err).Interface("stat.res", statResponse).Msg("stat failed") s.logger.Warn().Err(err).Interface("stat.res", statResponse).Msg("stat failed")
return libregraph.Permission{}, err return libregraph.Permission{}, err
@@ -284,7 +284,7 @@ func createShareRequestToFederatedUser(user libregraph.User, resourceId *storage
} }
// SpaceRootInvite handles invitation request on project spaces // SpaceRootInvite handles invitation request on project spaces
func (s DriveItemPermissionsService) SpaceRootInvite(ctx context.Context, driveID storageprovider.ResourceId, invite libregraph.DriveItemInvite) (libregraph.Permission, error) { func (s DriveItemPermissionsService) SpaceRootInvite(ctx context.Context, driveID *storageprovider.ResourceId, invite libregraph.DriveItemInvite) (libregraph.Permission, error) {
gatewayClient, err := s.gatewaySelector.Next() gatewayClient, err := s.gatewaySelector.Next()
if err != nil { if err != nil {
return libregraph.Permission{}, err return libregraph.Permission{}, err
@@ -300,7 +300,7 @@ func (s DriveItemPermissionsService) SpaceRootInvite(ctx context.Context, driveI
} }
rootResourceID := space.GetRoot() rootResourceID := space.GetRoot()
return s.Invite(ctx, *rootResourceID, invite) return s.Invite(ctx, rootResourceID, invite)
} }
// ListPermissions lists the permissions of a driveItem // ListPermissions lists the permissions of a driveItem
@@ -374,7 +374,7 @@ func (s DriveItemPermissionsService) ListPermissions(ctx context.Context, itemID
} }
// ListSpaceRootPermissions handles ListPermissions request on project spaces // ListSpaceRootPermissions handles ListPermissions request on project spaces
func (s DriveItemPermissionsService) ListSpaceRootPermissions(ctx context.Context, driveID storageprovider.ResourceId) (libregraph.CollectionOfPermissionsWithAllowedValues, error) { func (s DriveItemPermissionsService) ListSpaceRootPermissions(ctx context.Context, driveID *storageprovider.ResourceId) (libregraph.CollectionOfPermissionsWithAllowedValues, error) {
collectionOfPermissions := libregraph.CollectionOfPermissionsWithAllowedValues{} collectionOfPermissions := libregraph.CollectionOfPermissionsWithAllowedValues{}
gatewayClient, err := s.gatewaySelector.Next() gatewayClient, err := s.gatewaySelector.Next()
if err != nil { if err != nil {
@@ -396,7 +396,7 @@ func (s DriveItemPermissionsService) ListSpaceRootPermissions(ctx context.Contex
} }
// DeletePermission deletes a permission from a drive item // DeletePermission deletes a permission from a drive item
func (s DriveItemPermissionsService) DeletePermission(ctx context.Context, itemID storageprovider.ResourceId, permissionID string) error { func (s DriveItemPermissionsService) DeletePermission(ctx context.Context, itemID *storageprovider.ResourceId, permissionID string) error {
var permissionType permissionType var permissionType permissionType
sharedResourceID, err := s.getLinkPermissionResourceID(ctx, permissionID) sharedResourceID, err := s.getLinkPermissionResourceID(ctx, permissionID)
@@ -406,9 +406,9 @@ func (s DriveItemPermissionsService) DeletePermission(ctx context.Context, itemI
permissionType = Public permissionType = Public
// If the item id is referring to a space root and this is not a public share // If the item id is referring to a space root and this is not a public share
// we have to deal with space permissions // we have to deal with space permissions
case IsSpaceRoot(&itemID): case IsSpaceRoot(itemID):
permissionType = Space permissionType = Space
sharedResourceID = &itemID sharedResourceID = itemID
err = nil err = nil
// If this is neither a public share nor a space permission, check if this is a // If this is neither a public share nor a space permission, check if this is a
// user share // user share
@@ -430,7 +430,7 @@ func (s DriveItemPermissionsService) DeletePermission(ctx context.Context, itemI
// The resourceID of the shared resource need to match the item ID from the Request Path // The resourceID of the shared resource need to match the item ID from the Request Path
// otherwise this is an invalid Request. // otherwise this is an invalid Request.
if !utils.ResourceIDEqual(sharedResourceID, &itemID) { if !utils.ResourceIDEqual(sharedResourceID, itemID) {
s.logger.Debug().Msg("resourceID of shared does not match itemID") s.logger.Debug().Msg("resourceID of shared does not match itemID")
return errorcode.New(errorcode.InvalidRequest, "permissionID and itemID do not match") return errorcode.New(errorcode.InvalidRequest, "permissionID and itemID do not match")
} }
@@ -449,7 +449,7 @@ func (s DriveItemPermissionsService) DeletePermission(ctx context.Context, itemI
} }
// DeleteSpaceRootPermission deletes a permission on the root item of a project space // DeleteSpaceRootPermission deletes a permission on the root item of a project space
func (s DriveItemPermissionsService) DeleteSpaceRootPermission(ctx context.Context, driveID storageprovider.ResourceId, permissionID string) error { func (s DriveItemPermissionsService) DeleteSpaceRootPermission(ctx context.Context, driveID *storageprovider.ResourceId, permissionID string) error {
gatewayClient, err := s.gatewaySelector.Next() gatewayClient, err := s.gatewaySelector.Next()
if err != nil { if err != nil {
return err return err
@@ -465,26 +465,26 @@ func (s DriveItemPermissionsService) DeleteSpaceRootPermission(ctx context.Conte
} }
rootResourceID := space.GetRoot() rootResourceID := space.GetRoot()
return s.DeletePermission(ctx, *rootResourceID, permissionID) return s.DeletePermission(ctx, rootResourceID, permissionID)
} }
// UpdatePermission updates a permission on a drive item // UpdatePermission updates a permission on a drive item
func (s DriveItemPermissionsService) UpdatePermission(ctx context.Context, itemID storageprovider.ResourceId, permissionID string, newPermission libregraph.Permission) (libregraph.Permission, error) { func (s DriveItemPermissionsService) UpdatePermission(ctx context.Context, itemID *storageprovider.ResourceId, permissionID string, newPermission libregraph.Permission) (libregraph.Permission, error) {
oldPermission, sharedResourceID, err := s.getPermissionByID(ctx, permissionID, &itemID) oldPermission, sharedResourceID, err := s.getPermissionByID(ctx, permissionID, itemID)
if err != nil { if err != nil {
return libregraph.Permission{}, err return libregraph.Permission{}, err
} }
// The resourceID of the shared resource need to match the item ID from the Request Path // The resourceID of the shared resource need to match the item ID from the Request Path
// otherwise this is an invalid Request. // otherwise this is an invalid Request.
if !utils.ResourceIDEqual(sharedResourceID, &itemID) { if !utils.ResourceIDEqual(sharedResourceID, itemID) {
s.logger.Debug().Msg("resourceID of shared does not match itemID") s.logger.Debug().Msg("resourceID of shared does not match itemID")
return libregraph.Permission{}, errorcode.New(errorcode.InvalidRequest, "permissionID and itemID do not match") return libregraph.Permission{}, errorcode.New(errorcode.InvalidRequest, "permissionID and itemID do not match")
} }
// This is a public link // This is a public link
if _, ok := oldPermission.GetLinkOk(); ok { if _, ok := oldPermission.GetLinkOk(); ok {
updatedPermission, err := s.updatePublicLinkPermission(ctx, permissionID, &itemID, &newPermission) updatedPermission, err := s.updatePublicLinkPermission(ctx, permissionID, itemID, &newPermission)
if err != nil { if err != nil {
return libregraph.Permission{}, err return libregraph.Permission{}, err
} }
@@ -500,7 +500,7 @@ func (s DriveItemPermissionsService) UpdatePermission(ctx context.Context, itemI
} }
// UpdateSpaceRootPermission updates a permission on the root item of a project space // UpdateSpaceRootPermission updates a permission on the root item of a project space
func (s DriveItemPermissionsService) UpdateSpaceRootPermission(ctx context.Context, driveID storageprovider.ResourceId, permissionID string, newPermission libregraph.Permission) (libregraph.Permission, error) { func (s DriveItemPermissionsService) UpdateSpaceRootPermission(ctx context.Context, driveID *storageprovider.ResourceId, permissionID string, newPermission libregraph.Permission) (libregraph.Permission, error) {
gatewayClient, err := s.gatewaySelector.Next() gatewayClient, err := s.gatewaySelector.Next()
if err != nil { if err != nil {
return libregraph.Permission{}, err return libregraph.Permission{}, err
@@ -516,7 +516,7 @@ func (s DriveItemPermissionsService) UpdateSpaceRootPermission(ctx context.Conte
} }
rootResourceID := space.GetRoot() rootResourceID := space.GetRoot()
return s.UpdatePermission(ctx, *rootResourceID, permissionID, newPermission) return s.UpdatePermission(ctx, rootResourceID, permissionID, newPermission)
} }
// DriveItemPermissionsService is the api that registers the http endpoints which expose needed operation to the graph api. // DriveItemPermissionsService is the api that registers the http endpoints which expose needed operation to the graph api.
@@ -557,7 +557,7 @@ func (api DriveItemPermissionsApi) Invite(w http.ResponseWriter, r *http.Request
errorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, err.Error()) errorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, err.Error())
return return
} }
permission, err := api.driveItemPermissionsService.Invite(ctx, itemID, *driveItemInvite) permission, err := api.driveItemPermissionsService.Invite(ctx, &itemID, *driveItemInvite)
if err != nil { if err != nil {
errorcode.RenderError(w, r, err) errorcode.RenderError(w, r, err)
@@ -590,7 +590,7 @@ func (api DriveItemPermissionsApi) SpaceRootInvite(w http.ResponseWriter, r *htt
errorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, err.Error()) errorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, err.Error())
return return
} }
permission, err := api.driveItemPermissionsService.SpaceRootInvite(ctx, driveID, *driveItemInvite) permission, err := api.driveItemPermissionsService.SpaceRootInvite(ctx, &driveID, *driveItemInvite)
if err != nil { if err != nil {
errorcode.RenderError(w, r, err) errorcode.RenderError(w, r, err)
@@ -632,7 +632,7 @@ func (api DriveItemPermissionsApi) ListSpaceRootPermissions(w http.ResponseWrite
} }
ctx := r.Context() ctx := r.Context()
permissions, err := api.driveItemPermissionsService.ListSpaceRootPermissions(ctx, driveID) permissions, err := api.driveItemPermissionsService.ListSpaceRootPermissions(ctx, &driveID)
if err != nil { if err != nil {
errorcode.RenderError(w, r, err) errorcode.RenderError(w, r, err)
@@ -660,7 +660,7 @@ func (api DriveItemPermissionsApi) DeletePermission(w http.ResponseWriter, r *ht
} }
ctx := r.Context() ctx := r.Context()
err = api.driveItemPermissionsService.DeletePermission(ctx, itemID, permissionID) err = api.driveItemPermissionsService.DeletePermission(ctx, &itemID, permissionID)
if err != nil { if err != nil {
errorcode.RenderError(w, r, err) errorcode.RenderError(w, r, err)
return return
@@ -687,7 +687,7 @@ func (api DriveItemPermissionsApi) DeleteSpaceRootPermission(w http.ResponseWrit
} }
ctx := r.Context() ctx := r.Context()
err = api.driveItemPermissionsService.DeleteSpaceRootPermission(ctx, driveID, permissionID) err = api.driveItemPermissionsService.DeleteSpaceRootPermission(ctx, &driveID, permissionID)
if err != nil { if err != nil {
errorcode.RenderError(w, r, err) errorcode.RenderError(w, r, err)
return return
@@ -727,7 +727,7 @@ func (api DriveItemPermissionsApi) UpdatePermission(w http.ResponseWriter, r *ht
return return
} }
updatedPermission, err := api.driveItemPermissionsService.UpdatePermission(ctx, itemID, permissionID, permission) updatedPermission, err := api.driveItemPermissionsService.UpdatePermission(ctx, &itemID, permissionID, permission)
if err != nil { if err != nil {
errorcode.RenderError(w, r, err) errorcode.RenderError(w, r, err)
return return
@@ -766,7 +766,7 @@ func (api DriveItemPermissionsApi) UpdateSpaceRootPermission(w http.ResponseWrit
return return
} }
updatedPermission, err := api.driveItemPermissionsService.UpdateSpaceRootPermission(ctx, driveID, permissionID, permission) updatedPermission, err := api.driveItemPermissionsService.UpdateSpaceRootPermission(ctx, &driveID, permissionID, permission)
if err != nil { if err != nil {
errorcode.RenderError(w, r, err) errorcode.RenderError(w, r, err)
return return
@@ -20,7 +20,7 @@ import (
"github.com/owncloud/ocis/v2/services/graph/pkg/linktype" "github.com/owncloud/ocis/v2/services/graph/pkg/linktype"
) )
func (s DriveItemPermissionsService) CreateLink(ctx context.Context, driveItemID storageprovider.ResourceId, createLink libregraph.DriveItemCreateLink) (libregraph.Permission, error) { func (s DriveItemPermissionsService) CreateLink(ctx context.Context, driveItemID *storageprovider.ResourceId, createLink libregraph.DriveItemCreateLink) (libregraph.Permission, error) {
gatewayClient, err := s.gatewaySelector.Next() gatewayClient, err := s.gatewaySelector.Next()
if err != nil { if err != nil {
s.logger.Error().Err(err).Msg("could not select next gateway client") s.logger.Error().Err(err).Msg("could not select next gateway client")
@@ -31,7 +31,7 @@ func (s DriveItemPermissionsService) CreateLink(ctx context.Context, driveItemID
ctx, ctx,
&storageprovider.StatRequest{ &storageprovider.StatRequest{
Ref: &storageprovider.Reference{ Ref: &storageprovider.Reference{
ResourceId: &driveItemID, ResourceId: driveItemID,
Path: ".", Path: ".",
}, },
}) })
@@ -93,7 +93,7 @@ func (s DriveItemPermissionsService) CreateLink(ctx context.Context, driveItemID
return *perm, nil return *perm, nil
} }
func (s DriveItemPermissionsService) CreateSpaceRootLink(ctx context.Context, driveID storageprovider.ResourceId, createLink libregraph.DriveItemCreateLink) (libregraph.Permission, error) { func (s DriveItemPermissionsService) CreateSpaceRootLink(ctx context.Context, driveID *storageprovider.ResourceId, createLink libregraph.DriveItemCreateLink) (libregraph.Permission, error) {
gatewayClient, err := s.gatewaySelector.Next() gatewayClient, err := s.gatewaySelector.Next()
if err != nil { if err != nil {
return libregraph.Permission{}, err return libregraph.Permission{}, err
@@ -108,10 +108,10 @@ func (s DriveItemPermissionsService) CreateSpaceRootLink(ctx context.Context, dr
} }
rootResourceID := space.GetRoot() rootResourceID := space.GetRoot()
return s.CreateLink(ctx, *rootResourceID, createLink) return s.CreateLink(ctx, rootResourceID, createLink)
} }
func (s DriveItemPermissionsService) SetPublicLinkPassword(ctx context.Context, driveItemId storageprovider.ResourceId, permissionID string, password string) (libregraph.Permission, error) { func (s DriveItemPermissionsService) SetPublicLinkPassword(ctx context.Context, driveItemId *storageprovider.ResourceId, permissionID string, password string) (libregraph.Permission, error) {
publicShare, err := s.getCS3PublicShareByID(ctx, permissionID) publicShare, err := s.getCS3PublicShareByID(ctx, permissionID)
if err != nil { if err != nil {
return libregraph.Permission{}, err return libregraph.Permission{}, err
@@ -119,7 +119,7 @@ func (s DriveItemPermissionsService) SetPublicLinkPassword(ctx context.Context,
// The resourceID of the shared resource need to match the item ID from the Request Path // The resourceID of the shared resource need to match the item ID from the Request Path
// otherwise this is an invalid Request. // otherwise this is an invalid Request.
if !utils.ResourceIDEqual(publicShare.GetResourceId(), &driveItemId) { if !utils.ResourceIDEqual(publicShare.GetResourceId(), driveItemId) {
s.logger.Debug().Msg("resourceID of shared does not match itemID") s.logger.Debug().Msg("resourceID of shared does not match itemID")
return libregraph.Permission{}, errorcode.New(errorcode.InvalidRequest, "permissionID and itemID do not match") return libregraph.Permission{}, errorcode.New(errorcode.InvalidRequest, "permissionID and itemID do not match")
} }
@@ -131,7 +131,7 @@ func (s DriveItemPermissionsService) SetPublicLinkPassword(ctx context.Context,
return *permission, nil return *permission, nil
} }
func (s DriveItemPermissionsService) SetPublicLinkPasswordOnSpaceRoot(ctx context.Context, driveID storageprovider.ResourceId, permissionID string, password string) (libregraph.Permission, error) { func (s DriveItemPermissionsService) SetPublicLinkPasswordOnSpaceRoot(ctx context.Context, driveID *storageprovider.ResourceId, permissionID string, password string) (libregraph.Permission, error) {
gatewayClient, err := s.gatewaySelector.Next() gatewayClient, err := s.gatewaySelector.Next()
if err != nil { if err != nil {
return libregraph.Permission{}, err return libregraph.Permission{}, err
@@ -145,7 +145,7 @@ func (s DriveItemPermissionsService) SetPublicLinkPasswordOnSpaceRoot(ctx contex
return libregraph.Permission{}, errorcode.New(errorcode.InvalidRequest, "unsupported space type") return libregraph.Permission{}, errorcode.New(errorcode.InvalidRequest, "unsupported space type")
} }
rootResourceID := space.GetRoot() rootResourceID := space.GetRoot()
return s.SetPublicLinkPassword(ctx, *rootResourceID, permissionID, password) return s.SetPublicLinkPassword(ctx, rootResourceID, permissionID, password)
} }
// CreateLink creates a public link on the cs3 api // CreateLink creates a public link on the cs3 api
@@ -166,7 +166,7 @@ func (api DriveItemPermissionsApi) CreateLink(w http.ResponseWriter, r *http.Req
return return
} }
perm, err := api.driveItemPermissionsService.CreateLink(r.Context(), driveItemID, createLink) perm, err := api.driveItemPermissionsService.CreateLink(r.Context(), &driveItemID, createLink)
if err != nil { if err != nil {
errorcode.RenderError(w, r, err) errorcode.RenderError(w, r, err)
return return
@@ -195,7 +195,7 @@ func (api DriveItemPermissionsApi) CreateSpaceRootLink(w http.ResponseWriter, r
return return
} }
perm, err := api.driveItemPermissionsService.CreateSpaceRootLink(r.Context(), driveID, createLink) perm, err := api.driveItemPermissionsService.CreateSpaceRootLink(r.Context(), &driveID, createLink)
if err != nil { if err != nil {
errorcode.RenderError(w, r, err) errorcode.RenderError(w, r, err)
return return
@@ -228,7 +228,7 @@ func (api DriveItemPermissionsApi) SetLinkPassword(w http.ResponseWriter, r *htt
return return
} }
newPermission, err := api.driveItemPermissionsService.SetPublicLinkPassword(ctx, itemID, permissionID, password.GetPassword()) newPermission, err := api.driveItemPermissionsService.SetPublicLinkPassword(ctx, &itemID, permissionID, password.GetPassword())
if err != nil { if err != nil {
errorcode.RenderError(w, r, err) errorcode.RenderError(w, r, err)
return return
@@ -262,7 +262,7 @@ func (api DriveItemPermissionsApi) SetSpaceRootLinkPassword(w http.ResponseWrite
} }
ctx := r.Context() ctx := r.Context()
newPermission, err := api.driveItemPermissionsService.SetPublicLinkPasswordOnSpaceRoot(ctx, driveID, permissionID, password.GetPassword()) newPermission, err := api.driveItemPermissionsService.SetPublicLinkPasswordOnSpaceRoot(ctx, &driveID, permissionID, password.GetPassword())
if err != nil { if err != nil {
errorcode.RenderError(w, r, err) errorcode.RenderError(w, r, err)
return return
@@ -29,7 +29,7 @@ import (
var _ = Describe("createLinkTests", func() { var _ = Describe("createLinkTests", func() {
var ( var (
svc service.DriveItemPermissionsService svc service.DriveItemPermissionsService
driveItemId provider.ResourceId driveItemId *provider.ResourceId
ctx context.Context ctx context.Context
gatewayClient *cs3mocks.GatewayAPIClient gatewayClient *cs3mocks.GatewayAPIClient
gatewaySelector *mocks.Selectable[gateway.GatewayAPIClient] gatewaySelector *mocks.Selectable[gateway.GatewayAPIClient]
@@ -56,7 +56,7 @@ var _ = Describe("createLinkTests", func() {
cfg := defaults.FullDefaultConfig() cfg := defaults.FullDefaultConfig()
svc, err = service.NewDriveItemPermissionsService(logger, gatewaySelector, cache, cfg) svc, err = service.NewDriveItemPermissionsService(logger, gatewaySelector, cache, cfg)
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
driveItemId = provider.ResourceId{ driveItemId = &provider.ResourceId{
StorageId: "1", StorageId: "1",
SpaceId: "2", SpaceId: "2",
OpaqueId: "3", OpaqueId: "3",
@@ -225,7 +225,7 @@ var _ = Describe("createLinkTests", func() {
Id: &link.PublicShareId{ Id: &link.PublicShareId{
OpaqueId: "permissionid", OpaqueId: "permissionid",
}, },
ResourceId: &driveItemId, ResourceId: driveItemId,
Permissions: &link.PublicSharePermissions{ Permissions: &link.PublicSharePermissions{
Permissions: linktype.NewViewLinkPermissionSet().GetPermissions(), Permissions: linktype.NewViewLinkPermissionSet().GetPermissions(),
}, },
@@ -56,7 +56,7 @@ var _ = Describe("DriveItemPermissionsService", func() {
}, },
} }
statResponse *provider.StatResponse statResponse *provider.StatResponse
driveItemId provider.ResourceId driveItemId *provider.ResourceId
ctx context.Context ctx context.Context
) )
@@ -88,7 +88,7 @@ var _ = Describe("DriveItemPermissionsService", func() {
Status: status.NewOK(ctx), Status: status.NewOK(ctx),
} }
driveItemId = provider.ResourceId{ driveItemId = &provider.ResourceId{
StorageId: "1", StorageId: "1",
SpaceId: "2", SpaceId: "2",
OpaqueId: "3", OpaqueId: "3",
@@ -106,7 +106,7 @@ var _ = Describe("DriveItemPermissionsService", func() {
BeforeEach(func() { BeforeEach(func() {
gatewayClient.On("Stat", mock.Anything, mock.Anything).Return(statResponse, nil) gatewayClient.On("Stat", mock.Anything, mock.Anything).Return(statResponse, nil)
statResponse.Info = &provider.ResourceInfo{ statResponse.Info = &provider.ResourceInfo{
Id: &driveItemId, Id: driveItemId,
Type: provider.ResourceType_RESOURCE_TYPE_FILE, Type: provider.ResourceType_RESOURCE_TYPE_FILE,
} }
@@ -258,12 +258,12 @@ var _ = Describe("DriveItemPermissionsService", func() {
var ( var (
createShareResponse *collaboration.CreateShareResponse createShareResponse *collaboration.CreateShareResponse
driveItemInvite libregraph.DriveItemInvite driveItemInvite libregraph.DriveItemInvite
driveId provider.ResourceId driveId *provider.ResourceId
getUserResponse *userpb.GetUserResponse getUserResponse *userpb.GetUserResponse
) )
BeforeEach(func() { BeforeEach(func() {
driveId = provider.ResourceId{ driveId = &provider.ResourceId{
StorageId: "1", StorageId: "1",
SpaceId: "2", SpaceId: "2",
} }
@@ -423,11 +423,11 @@ var _ = Describe("DriveItemPermissionsService", func() {
}) })
Describe("ListSpaceRootPermissions", func() { Describe("ListSpaceRootPermissions", func() {
var ( var (
driveId provider.ResourceId driveId *provider.ResourceId
) )
BeforeEach(func() { BeforeEach(func() {
driveId = provider.ResourceId{ driveId = &provider.ResourceId{
StorageId: "1", StorageId: "1",
SpaceId: "2", SpaceId: "2",
} }
@@ -489,7 +489,7 @@ var _ = Describe("DriveItemPermissionsService", func() {
gatewayClient.On("GetPublicShare", mock.Anything, mock.Anything).Return(&getPublicShareResponse, nil) gatewayClient.On("GetPublicShare", mock.Anything, mock.Anything).Return(&getPublicShareResponse, nil)
err := driveItemPermissionsService.DeletePermission(context.Background(), err := driveItemPermissionsService.DeletePermission(context.Background(),
*getShareResponse.Share.ResourceId, getShareResponse.Share.ResourceId,
"permissionid", "permissionid",
) )
Expect(err).To(MatchError(errorcode.New(errorcode.ItemNotFound, "failed to resolve resource id for shared resource"))) Expect(err).To(MatchError(errorcode.New(errorcode.ItemNotFound, "failed to resolve resource id for shared resource")))
@@ -515,7 +515,7 @@ var _ = Describe("DriveItemPermissionsService", func() {
).Return(rmShareMockResponse, nil) ).Return(rmShareMockResponse, nil)
err := driveItemPermissionsService.DeletePermission(context.Background(), err := driveItemPermissionsService.DeletePermission(context.Background(),
*getShareResponse.Share.ResourceId, getShareResponse.Share.ResourceId,
"permissionid", "permissionid",
) )
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
@@ -545,7 +545,7 @@ var _ = Describe("DriveItemPermissionsService", func() {
) )
err := driveItemPermissionsService.DeletePermission(context.Background(), err := driveItemPermissionsService.DeletePermission(context.Background(),
*getShareResponse.Share.ResourceId, getShareResponse.Share.ResourceId,
"linkpermissionid", "linkpermissionid",
) )
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
@@ -564,7 +564,7 @@ var _ = Describe("DriveItemPermissionsService", func() {
}) })
err := driveItemPermissionsService.DeletePermission(context.Background(), err := driveItemPermissionsService.DeletePermission(context.Background(),
provider.ResourceId{ &provider.ResourceId{
StorageId: "1", StorageId: "1",
SpaceId: "2", SpaceId: "2",
OpaqueId: "2", OpaqueId: "2",
@@ -597,7 +597,7 @@ var _ = Describe("DriveItemPermissionsService", func() {
ctx = context.WithValue(context.Background(), chi.RouteCtxKey, rctx) ctx = context.WithValue(context.Background(), chi.RouteCtxKey, rctx)
err := driveItemPermissionsService.DeletePermission(context.Background(), err := driveItemPermissionsService.DeletePermission(context.Background(),
provider.ResourceId{ &provider.ResourceId{
StorageId: "1", StorageId: "1",
SpaceId: "2", SpaceId: "2",
OpaqueId: "3", OpaqueId: "3",
@@ -625,7 +625,7 @@ var _ = Describe("DriveItemPermissionsService", func() {
Id: &collaboration.ShareId{ Id: &collaboration.ShareId{
OpaqueId: "permissionid", OpaqueId: "permissionid",
}, },
ResourceId: &driveItemId, ResourceId: driveItemId,
Grantee: &provider.Grantee{ Grantee: &provider.Grantee{
Type: provider.GranteeType_GRANTEE_TYPE_USER, Type: provider.GranteeType_GRANTEE_TYPE_USER,
Id: &provider.Grantee_UserId{ Id: &provider.Grantee_UserId{
@@ -659,7 +659,7 @@ var _ = Describe("DriveItemPermissionsService", func() {
Id: &link.PublicShareId{ Id: &link.PublicShareId{
OpaqueId: "permissionid", OpaqueId: "permissionid",
}, },
ResourceId: &driveItemId, ResourceId: driveItemId,
Permissions: &link.PublicSharePermissions{ Permissions: &link.PublicSharePermissions{
Permissions: linktype.NewViewLinkPermissionSet().GetPermissions(), Permissions: linktype.NewViewLinkPermissionSet().GetPermissions(),
}, },
@@ -669,7 +669,7 @@ var _ = Describe("DriveItemPermissionsService", func() {
statResponse = &provider.StatResponse{ statResponse = &provider.StatResponse{
Status: status.NewOK(ctx), Status: status.NewOK(ctx),
Info: &provider.ResourceInfo{ Info: &provider.ResourceInfo{
Id: &driveItemId, Id: driveItemId,
Type: provider.ResourceType_RESOURCE_TYPE_CONTAINER, Type: provider.ResourceType_RESOURCE_TYPE_CONTAINER,
}, },
} }
@@ -739,7 +739,7 @@ var _ = Describe("DriveItemPermissionsService", func() {
})).Return(getPublicShareMockResponse, nil) })).Return(getPublicShareMockResponse, nil)
gatewayClient.On("Stat", mock.Anything, mock.MatchedBy(func(req *provider.StatRequest) bool { gatewayClient.On("Stat", mock.Anything, mock.MatchedBy(func(req *provider.StatRequest) bool {
return utils.ResourceIDEqual(req.GetRef().GetResourceId(), &driveItemId) && req.GetRef().GetPath() == "." return utils.ResourceIDEqual(req.GetRef().GetResourceId(), driveItemId) && req.GetRef().GetPath() == "."
})).Return(statResponse, nil) })).Return(statResponse, nil)
gatewayClient.On("UpdatePublicShare", gatewayClient.On("UpdatePublicShare",
@@ -851,7 +851,7 @@ var _ = Describe("DriveItemPermissionsService", func() {
gatewayClient.On("GetUser", mock.Anything, mock.Anything).Return(getUserResponse, nil) gatewayClient.On("GetUser", mock.Anything, mock.Anything).Return(getUserResponse, nil)
driveItemPermission.SetRoles([]string{unifiedrole.NewFileEditorUnifiedRole().GetId()}) driveItemPermission.SetRoles([]string{unifiedrole.NewFileEditorUnifiedRole().GetId()})
spaceId := provider.ResourceId{ spaceId := &provider.ResourceId{
StorageId: "1", StorageId: "1",
SpaceId: "2", SpaceId: "2",
OpaqueId: "2", OpaqueId: "2",
@@ -1072,7 +1072,7 @@ var _ = Describe("DriveItemPermissionsApi", func() {
onInvite := mockProvider.On("Invite", mock.Anything, mock.Anything, mock.Anything) onInvite := mockProvider.On("Invite", mock.Anything, mock.Anything, mock.Anything)
onInvite.Return(func(ctx context.Context, resourceID storageprovider.ResourceId, invite libregraph.DriveItemInvite) (libregraph.Permission, error) { onInvite.Return(func(ctx context.Context, resourceID *storageprovider.ResourceId, invite libregraph.DriveItemInvite) (libregraph.Permission, error) {
return libregraph.Permission{}, errors.New("any") return libregraph.Permission{}, errors.New("any")
}).Once() }).Once()
@@ -1088,7 +1088,7 @@ var _ = Describe("DriveItemPermissionsApi", func() {
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
onInvite := mockProvider.On("Invite", mock.Anything, mock.Anything, mock.Anything) onInvite := mockProvider.On("Invite", mock.Anything, mock.Anything, mock.Anything)
onInvite.Return(func(ctx context.Context, resourceID storageprovider.ResourceId, invite libregraph.DriveItemInvite) (libregraph.Permission, error) { onInvite.Return(func(ctx context.Context, resourceID *storageprovider.ResourceId, invite libregraph.DriveItemInvite) (libregraph.Permission, error) {
Expect(storagespace.FormatResourceID(resourceID)).To(Equal("1$2!3")) Expect(storagespace.FormatResourceID(resourceID)).To(Equal("1$2!3"))
return libregraph.Permission{}, nil return libregraph.Permission{}, nil
}).Once() }).Once()
@@ -1109,7 +1109,7 @@ var _ = Describe("DriveItemPermissionsApi", func() {
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
onInvite := mockProvider.On("SpaceRootInvite", mock.Anything, mock.Anything, mock.Anything) onInvite := mockProvider.On("SpaceRootInvite", mock.Anything, mock.Anything, mock.Anything)
onInvite.Return(func(ctx context.Context, driveID storageprovider.ResourceId, invite libregraph.DriveItemInvite) (libregraph.Permission, error) { onInvite.Return(func(ctx context.Context, driveID *storageprovider.ResourceId, invite libregraph.DriveItemInvite) (libregraph.Permission, error) {
Expect(storagespace.FormatResourceID(driveID)).To(Equal("1$2")) Expect(storagespace.FormatResourceID(driveID)).To(Equal("1$2"))
return libregraph.Permission{}, nil return libregraph.Permission{}, nil
}).Once() }).Once()
@@ -1146,7 +1146,7 @@ var _ = Describe("DriveItemPermissionsApi", func() {
mockProvider.On("ListPermissions", mock.Anything, mock.Anything, mock.Anything). mockProvider.On("ListPermissions", mock.Anything, mock.Anything, mock.Anything).
Return(func(ctx context.Context, itemid storageprovider.ResourceId) (libregraph.CollectionOfPermissionsWithAllowedValues, error) { Return(func(ctx context.Context, itemid storageprovider.ResourceId) (libregraph.CollectionOfPermissionsWithAllowedValues, error) {
Expect(storagespace.FormatResourceID(itemid)).To(Equal("1$2!3")) Expect(storagespace.FormatResourceID(&itemid)).To(Equal("1$2!3"))
return libregraph.CollectionOfPermissionsWithAllowedValues{}, nil return libregraph.CollectionOfPermissionsWithAllowedValues{}, nil
}).Once() }).Once()
@@ -55,7 +55,7 @@ var _ = Describe("Applications", func() {
gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient]( gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient](
"GatewaySelector", "GatewaySelector",
"com.owncloud.api.gateway", "com.owncloud.api.gateway",
func(cc *grpc.ClientConn) gateway.GatewayAPIClient { func(cc grpc.ClientConnInterface) gateway.GatewayAPIClient {
return gatewayClient return gatewayClient
}, },
) )
@@ -65,7 +65,7 @@ var _ = Describe("AppRoleAssignments", func() {
gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient]( gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient](
"GatewaySelector", "GatewaySelector",
"com.owncloud.api.gateway", "com.owncloud.api.gateway",
func(cc *grpc.ClientConn) gateway.GatewayAPIClient { func(cc grpc.ClientConnInterface) gateway.GatewayAPIClient {
return gatewayClient return gatewayClient
}, },
) )
+2 -2
View File
@@ -308,7 +308,7 @@ func (g BaseGraphService) listPublicShares(ctx context.Context, filters []*link.
func (g BaseGraphService) cs3UserSharesToDriveItems(ctx context.Context, shares []*collaboration.Share, driveItems driveItemsByResourceID) (driveItemsByResourceID, error) { func (g BaseGraphService) cs3UserSharesToDriveItems(ctx context.Context, shares []*collaboration.Share, driveItems driveItemsByResourceID) (driveItemsByResourceID, error) {
for _, s := range shares { for _, s := range shares {
g.logger.Debug().Interface("CS3 UserShare", s).Msg("Got Share") g.logger.Debug().Interface("CS3 UserShare", s).Msg("Got Share")
resIDStr := storagespace.FormatResourceID(*s.ResourceId) resIDStr := storagespace.FormatResourceID(s.ResourceId)
item, ok := driveItems[resIDStr] item, ok := driveItems[resIDStr]
if !ok { if !ok {
itemptr, err := g.getDriveItem(ctx, storageprovider.Reference{ResourceId: s.ResourceId}) itemptr, err := g.getDriveItem(ctx, storageprovider.Reference{ResourceId: s.ResourceId})
@@ -410,7 +410,7 @@ func (g BaseGraphService) cs3UserShareToPermission(ctx context.Context, share *c
func (g BaseGraphService) cs3PublicSharesToDriveItems(ctx context.Context, shares []*link.PublicShare, driveItems driveItemsByResourceID) (driveItemsByResourceID, error) { func (g BaseGraphService) cs3PublicSharesToDriveItems(ctx context.Context, shares []*link.PublicShare, driveItems driveItemsByResourceID) (driveItemsByResourceID, error) {
for _, s := range shares { for _, s := range shares {
g.logger.Debug().Interface("CS3 PublicShare", s).Msg("Got Share") g.logger.Debug().Interface("CS3 PublicShare", s).Msg("Got Share")
resIDStr := storagespace.FormatResourceID(*s.ResourceId) resIDStr := storagespace.FormatResourceID(s.ResourceId)
item, ok := driveItems[resIDStr] item, ok := driveItems[resIDStr]
if !ok { if !ok {
itemptr, err := g.getDriveItem(ctx, storageprovider.Reference{ResourceId: s.ResourceId}) itemptr, err := g.getDriveItem(ctx, storageprovider.Reference{ResourceId: s.ResourceId})
+5 -5
View File
@@ -409,7 +409,7 @@ func (g Graph) getRemoteItem(ctx context.Context, root *storageprovider.Resource
if res.GetInfo().GetSpace().GetRoot() != nil { if res.GetInfo().GetSpace().GetRoot() != nil {
webDavURL := *baseURL webDavURL := *baseURL
relativePath := res.GetInfo().GetPath() relativePath := res.GetInfo().GetPath()
webDavURL.Path = path.Join(webDavURL.Path, storagespace.FormatResourceID(*res.GetInfo().GetSpace().GetRoot()), relativePath) webDavURL.Path = path.Join(webDavURL.Path, storagespace.FormatResourceID(res.GetInfo().GetSpace().GetRoot()), relativePath)
item.WebDavUrl = libregraph.PtrString(webDavURL.String()) item.WebDavUrl = libregraph.PtrString(webDavURL.String())
} }
} }
@@ -438,7 +438,7 @@ func cs3ResourceToDriveItem(logger *log.Logger, res *storageprovider.ResourceInf
*size = int64(res.GetSize()) // TODO lurking overflow: make size of libregraph drive item use uint64 *size = int64(res.GetSize()) // TODO lurking overflow: make size of libregraph drive item use uint64
driveItem := &libregraph.DriveItem{ driveItem := &libregraph.DriveItem{
Id: libregraph.PtrString(storagespace.FormatResourceID(*res.GetId())), Id: libregraph.PtrString(storagespace.FormatResourceID(res.GetId())),
Size: size, Size: size,
} }
@@ -456,7 +456,7 @@ func cs3ResourceToDriveItem(logger *log.Logger, res *storageprovider.ResourceInf
parentRef := libregraph.NewItemReference() parentRef := libregraph.NewItemReference()
parentRef.SetDriveType(res.GetSpace().GetSpaceType()) parentRef.SetDriveType(res.GetSpace().GetSpaceType())
parentRef.SetDriveId(storagespace.FormatStorageID(res.GetParentId().GetStorageId(), res.GetParentId().GetSpaceId())) parentRef.SetDriveId(storagespace.FormatStorageID(res.GetParentId().GetStorageId(), res.GetParentId().GetSpaceId()))
parentRef.SetId(storagespace.FormatResourceID(*res.GetParentId())) parentRef.SetId(storagespace.FormatResourceID(res.GetParentId()))
parentRef.SetName(path.Base(path.Dir(res.GetPath()))) parentRef.SetName(path.Base(path.Dir(res.GetPath())))
parentRef.SetPath(path.Dir(res.GetPath())) parentRef.SetPath(path.Dir(res.GetPath()))
driveItem.ParentReference = parentRef driveItem.ParentReference = parentRef
@@ -602,7 +602,7 @@ func cs3ResourceToRemoteItem(res *storageprovider.ResourceInfo) (*libregraph.Rem
*size = int64(res.GetSize()) // TODO lurking overflow: make size of libregraph drive item use uint64 *size = int64(res.GetSize()) // TODO lurking overflow: make size of libregraph drive item use uint64
remoteItem := &libregraph.RemoteItem{ remoteItem := &libregraph.RemoteItem{
Id: libregraph.PtrString(storagespace.FormatResourceID(*res.GetId())), Id: libregraph.PtrString(storagespace.FormatResourceID(res.GetId())),
Size: size, Size: size,
} }
@@ -626,7 +626,7 @@ func cs3ResourceToRemoteItem(res *storageprovider.ResourceInfo) (*libregraph.Rem
remoteItem.Folder = &libregraph.Folder{} remoteItem.Folder = &libregraph.Folder{}
} }
if res.GetSpace() != nil && res.GetSpace().GetRoot() != nil { if res.GetSpace() != nil && res.GetSpace().GetRoot() != nil {
remoteItem.RootId = libregraph.PtrString(storagespace.FormatResourceID(*res.GetSpace().GetRoot())) remoteItem.RootId = libregraph.PtrString(storagespace.FormatResourceID(res.GetSpace().GetRoot()))
grantSpaceAlias := utils.ReadPlainFromOpaque(res.GetSpace().GetOpaque(), "spaceAlias") grantSpaceAlias := utils.ReadPlainFromOpaque(res.GetSpace().GetOpaque(), "spaceAlias")
if grantSpaceAlias != "" { if grantSpaceAlias != "" {
remoteItem.DriveAlias = libregraph.PtrString(grantSpaceAlias) remoteItem.DriveAlias = libregraph.PtrString(grantSpaceAlias)
@@ -66,7 +66,7 @@ var _ = Describe("Driveitems", func() {
gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient]( gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient](
"GatewaySelector", "GatewaySelector",
"com.owncloud.api.gateway", "com.owncloud.api.gateway",
func(cc *grpc.ClientConn) gateway.GatewayAPIClient { func(cc grpc.ClientConnInterface) gateway.GatewayAPIClient {
return gatewayClient return gatewayClient
}, },
) )
+6 -5
View File
@@ -23,6 +23,7 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
merrors "go-micro.dev/v4/errors" merrors "go-micro.dev/v4/errors"
"golang.org/x/sync/errgroup" "golang.org/x/sync/errgroup"
"google.golang.org/protobuf/proto"
revactx "github.com/cs3org/reva/v2/pkg/ctx" revactx "github.com/cs3org/reva/v2/pkg/ctx"
"github.com/cs3org/reva/v2/pkg/storagespace" "github.com/cs3org/reva/v2/pkg/storagespace"
@@ -259,7 +260,7 @@ func (g Graph) GetSingleDrive(w http.ResponseWriter, r *http.Request) {
log.Debug().Msg("calling list storage spaces with id filter") log.Debug().Msg("calling list storage spaces with id filter")
filters := []*storageprovider.ListStorageSpacesRequest_Filter{ filters := []*storageprovider.ListStorageSpacesRequest_Filter{
listStorageSpacesIDFilter(storagespace.FormatResourceID(rid)), listStorageSpacesIDFilter(storagespace.FormatResourceID(&rid)),
} }
res, err := g.ListStorageSpacesWithFilters(ctx, filters, true) res, err := g.ListStorageSpacesWithFilters(ctx, filters, true)
switch { switch {
@@ -492,7 +493,7 @@ func (g Graph) UpdateDrive(w http.ResponseWriter, r *http.Request) {
// the original storage space. // the original storage space.
StorageSpace: &storageprovider.StorageSpace{ StorageSpace: &storageprovider.StorageSpace{
Id: &storageprovider.StorageSpaceId{ Id: &storageprovider.StorageSpaceId{
OpaqueId: storagespace.FormatResourceID(rid), OpaqueId: storagespace.FormatResourceID(&rid),
}, },
Root: root, Root: root,
}, },
@@ -743,7 +744,7 @@ func (g Graph) cs3StorageSpaceToDrive(ctx context.Context, baseURL *url.URL, spa
logger.Error().Msg("unable to parse space: space has no root") logger.Error().Msg("unable to parse space: space has no root")
return nil, errors.New("space has no root") return nil, errors.New("space has no root")
} }
spaceRid := *space.Root spaceRid := proto.Clone(space.Root).(*storageprovider.ResourceId)
if space.Root.GetSpaceId() == space.Root.GetOpaqueId() { if space.Root.GetSpaceId() == space.Root.GetOpaqueId() {
spaceRid.OpaqueId = "" spaceRid.OpaqueId = ""
} }
@@ -1047,11 +1048,11 @@ func (g Graph) DeleteDrive(w http.ResponseWriter, r *http.Request) {
dRes, err := gatewayClient.DeleteStorageSpace(r.Context(), &storageprovider.DeleteStorageSpaceRequest{ dRes, err := gatewayClient.DeleteStorageSpace(r.Context(), &storageprovider.DeleteStorageSpaceRequest{
Opaque: opaque, Opaque: opaque,
Id: &storageprovider.StorageSpaceId{ Id: &storageprovider.StorageSpaceId{
OpaqueId: storagespace.FormatResourceID(rid), OpaqueId: storagespace.FormatResourceID(&rid),
}, },
}) })
if err != nil { if err != nil {
logger.Error().Err(err).Interface("id", rid).Msg("could not delete drive: transport error") logger.Error().Err(err).Str("id", rid.String()).Msg("could not delete drive: transport error")
errorcode.GeneralException.Render(w, r, http.StatusInternalServerError, "transport error") errorcode.GeneralException.Render(w, r, http.StatusInternalServerError, "transport error")
return return
} }
@@ -58,7 +58,7 @@ var _ = Describe("EducationClass", func() {
gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient]( gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient](
"GatewaySelector", "GatewaySelector",
"com.owncloud.api.gateway", "com.owncloud.api.gateway",
func(cc *grpc.ClientConn) gateway.GatewayAPIClient { func(cc grpc.ClientConnInterface) gateway.GatewayAPIClient {
return gatewayClient return gatewayClient
}, },
) )
@@ -59,7 +59,7 @@ var _ = Describe("Schools", func() {
gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient]( gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient](
"GatewaySelector", "GatewaySelector",
"com.owncloud.api.gateway", "com.owncloud.api.gateway",
func(cc *grpc.ClientConn) gateway.GatewayAPIClient { func(cc grpc.ClientConnInterface) gateway.GatewayAPIClient {
return gatewayClient return gatewayClient
}, },
) )
@@ -63,7 +63,7 @@ var _ = Describe("EducationUsers", func() {
gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient]( gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient](
"GatewaySelector", "GatewaySelector",
"com.owncloud.api.gateway", "com.owncloud.api.gateway",
func(cc *grpc.ClientConn) gateway.GatewayAPIClient { func(cc grpc.ClientConnInterface) gateway.GatewayAPIClient {
return gatewayClient return gatewayClient
}, },
) )
+1 -1
View File
@@ -73,7 +73,7 @@ var _ = Describe("Graph", func() {
gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient]( gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient](
"GatewaySelector", "GatewaySelector",
"com.owncloud.api.gateway", "com.owncloud.api.gateway",
func(cc *grpc.ClientConn) gateway.GatewayAPIClient { func(cc grpc.ClientConnInterface) gateway.GatewayAPIClient {
return gatewayClient return gatewayClient
}, },
) )
+1 -1
View File
@@ -64,7 +64,7 @@ var _ = Describe("Groups", func() {
gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient]( gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient](
"GatewaySelector", "GatewaySelector",
"com.owncloud.api.gateway", "com.owncloud.api.gateway",
func(cc *grpc.ClientConn) gateway.GatewayAPIClient { func(cc grpc.ClientConnInterface) gateway.GatewayAPIClient {
return gatewayClient return gatewayClient
}, },
) )
@@ -56,7 +56,7 @@ var _ = Describe("Users changing their own password", func() {
gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient]( gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient](
"GatewaySelector", "GatewaySelector",
"com.owncloud.api.gateway", "com.owncloud.api.gateway",
func(cc *grpc.ClientConn) gateway.GatewayAPIClient { func(cc grpc.ClientConnInterface) gateway.GatewayAPIClient {
return gatewayClient return gatewayClient
}, },
) )
@@ -229,7 +229,7 @@ var _ = Describe("sharedbyme", func() {
gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient]( gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient](
"GatewaySelector", "GatewaySelector",
"com.owncloud.api.gateway", "com.owncloud.api.gateway",
func(cc *grpc.ClientConn) gateway.GatewayAPIClient { func(cc grpc.ClientConnInterface) gateway.GatewayAPIClient {
return gatewayClient return gatewayClient
}, },
) )
@@ -336,7 +336,7 @@ var _ = Describe("sharedbyme", func() {
Expect(len(res.Value)).To(Equal(1)) Expect(len(res.Value)).To(Equal(1))
di := res.Value[0] di := res.Value[0]
Expect(di.GetId()).To(Equal(storagespace.FormatResourceID(*userShare.GetResourceId()))) Expect(di.GetId()).To(Equal(storagespace.FormatResourceID(userShare.GetResourceId())))
perm := di.GetPermissions() perm := di.GetPermissions()
Expect(perm[0].GetId()).To(Equal(userShare.GetId().GetOpaqueId())) Expect(perm[0].GetId()).To(Equal(userShare.GetId().GetOpaqueId()))
@@ -380,7 +380,7 @@ var _ = Describe("sharedbyme", func() {
Expect(len(res.Value)).To(Equal(1)) Expect(len(res.Value)).To(Equal(1))
di := res.Value[0] di := res.Value[0]
Expect(di.GetId()).To(Equal(storagespace.FormatResourceID(*groupShare.GetResourceId()))) Expect(di.GetId()).To(Equal(storagespace.FormatResourceID(groupShare.GetResourceId())))
perm := di.GetPermissions() perm := di.GetPermissions()
Expect(perm[0].GetId()).To(Equal(userShare.GetId().GetOpaqueId())) Expect(perm[0].GetId()).To(Equal(userShare.GetId().GetOpaqueId()))
@@ -425,7 +425,7 @@ var _ = Describe("sharedbyme", func() {
Expect(len(res.Value)).To(Equal(1)) Expect(len(res.Value)).To(Equal(1))
di := res.Value[0] di := res.Value[0]
Expect(di.GetId()).To(Equal(storagespace.FormatResourceID(*groupShare.GetResourceId()))) Expect(di.GetId()).To(Equal(storagespace.FormatResourceID(groupShare.GetResourceId())))
// one permission per share // one permission per share
Expect(len(di.GetPermissions())).To(Equal(2)) Expect(len(di.GetPermissions())).To(Equal(2))
@@ -456,7 +456,7 @@ var _ = Describe("sharedbyme", func() {
Expect(len(res.Value)).To(Equal(1)) Expect(len(res.Value)).To(Equal(1))
di := res.Value[0] di := res.Value[0]
Expect(di.GetId()).To(Equal(storagespace.FormatResourceID(*userShareWithExpiration.GetResourceId()))) Expect(di.GetId()).To(Equal(storagespace.FormatResourceID(userShareWithExpiration.GetResourceId())))
perm := di.GetPermissions() perm := di.GetPermissions()
Expect(perm[0].GetId()).To(Equal(userShareWithExpiration.GetId().GetOpaqueId())) Expect(perm[0].GetId()).To(Equal(userShareWithExpiration.GetId().GetOpaqueId()))
@@ -519,7 +519,7 @@ var _ = Describe("sharedbyme", func() {
Expect(len(res.Value)).To(Equal(1)) Expect(len(res.Value)).To(Equal(1))
di := res.Value[0] di := res.Value[0]
Expect(di.GetId()).To(Equal(storagespace.FormatResourceID(*publicShare.GetResourceId()))) Expect(di.GetId()).To(Equal(storagespace.FormatResourceID(publicShare.GetResourceId())))
perm := di.GetPermissions() perm := di.GetPermissions()
Expect(perm[0].GetId()).To(Equal(publicShare.GetId().GetOpaqueId())) Expect(perm[0].GetId()).To(Equal(publicShare.GetId().GetOpaqueId()))
@@ -52,7 +52,7 @@ var _ = Describe("SharedWithMe", func() {
gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient]( gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient](
"GatewaySelector", "GatewaySelector",
"com.owncloud.api.gateway", "com.owncloud.api.gateway",
func(cc *grpc.ClientConn) gateway.GatewayAPIClient { func(cc grpc.ClientConnInterface) gateway.GatewayAPIClient {
return gatewayClient return gatewayClient
}, },
) )
@@ -253,7 +253,7 @@ var _ = Describe("SharedWithMe", func() {
Expect(jsonData.Get("eTag").String()).To(Equal(resourceInfo.Etag)) Expect(jsonData.Get("eTag").String()).To(Equal(resourceInfo.Etag))
Expect(jsonData.Get("id").String()).To(Equal(storagespace.FormatResourceID( Expect(jsonData.Get("id").String()).To(Equal(storagespace.FormatResourceID(
providerv1beta1.ResourceId{ &providerv1beta1.ResourceId{
StorageId: utils.ShareStorageProviderID, StorageId: utils.ShareStorageProviderID,
SpaceId: utils.ShareStorageSpaceID, SpaceId: utils.ShareStorageSpaceID,
OpaqueId: share.Id.OpaqueId, OpaqueId: share.Id.OpaqueId,
@@ -299,7 +299,7 @@ var _ = Describe("SharedWithMe", func() {
jsonData := gjson.Get(tape.Body.String(), "value.0.remoteItem") jsonData := gjson.Get(tape.Body.String(), "value.0.remoteItem")
Expect(jsonData.Get("eTag").String()).To(Equal(resourceInfo.Etag)) Expect(jsonData.Get("eTag").String()).To(Equal(resourceInfo.Etag))
Expect(jsonData.Get("id").String()).To(Equal(storagespace.FormatResourceID(*share.ResourceId))) Expect(jsonData.Get("id").String()).To(Equal(storagespace.FormatResourceID(share.ResourceId)))
Expect(jsonData.Get("lastModifiedDateTime").String()).To(Equal(utils.TSToTime(resourceInfo.Mtime).Format(time.RFC3339Nano))) Expect(jsonData.Get("lastModifiedDateTime").String()).To(Equal(utils.TSToTime(resourceInfo.Mtime).Format(time.RFC3339Nano)))
Expect(jsonData.Get("name").String()).To(Equal(resourceInfo.Name)) Expect(jsonData.Get("name").String()).To(Equal(resourceInfo.Name))
Expect(jsonData.Get("size").Num).To(Equal(float64(resourceInfo.Size))) Expect(jsonData.Get("size").Num).To(Equal(float64(resourceInfo.Size)))
@@ -89,7 +89,7 @@ func (g Graph) applyDefaultTemplate(ctx context.Context, gwc gateway.GatewayAPIC
resp, err := gwc.UpdateStorageSpace(ctx, &storageprovider.UpdateStorageSpaceRequest{ resp, err := gwc.UpdateStorageSpace(ctx, &storageprovider.UpdateStorageSpaceRequest{
StorageSpace: &storageprovider.StorageSpace{ StorageSpace: &storageprovider.StorageSpace{
Id: &storageprovider.StorageSpaceId{ Id: &storageprovider.StorageSpaceId{
OpaqueId: storagespace.FormatResourceID(*root), OpaqueId: storagespace.FormatResourceID(root),
}, },
Root: root, Root: root,
Opaque: opaque, Opaque: opaque,
+1 -1
View File
@@ -70,7 +70,7 @@ var _ = Describe("Users", func() {
gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient]( gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient](
"GatewaySelector", "GatewaySelector",
"com.owncloud.api.gateway", "com.owncloud.api.gateway",
func(cc *grpc.ClientConn) gateway.GatewayAPIClient { func(cc grpc.ClientConnInterface) gateway.GatewayAPIClient {
return gatewayClient return gatewayClient
}, },
) )
+9 -9
View File
@@ -156,7 +156,7 @@ func cs3ReceivedSharesToDriveItems(ctx context.Context,
continue continue
} }
rIDStr := storagespace.FormatResourceID(*receivedShare.GetShare().GetResourceId()) rIDStr := storagespace.FormatResourceID(receivedShare.GetShare().GetResourceId())
receivedSharesByResourceID[rIDStr] = append(receivedSharesByResourceID[rIDStr], receivedShare) receivedSharesByResourceID[rIDStr] = append(receivedSharesByResourceID[rIDStr], receivedShare)
} }
@@ -203,7 +203,7 @@ func cs3ReceivedSharesToDriveItems(ctx context.Context,
remoteItem := driveItem.RemoteItem remoteItem := driveItem.RemoteItem
{ {
if id := shareStat.GetInfo().GetId(); id != nil { if id := shareStat.GetInfo().GetId(); id != nil {
remoteItem.SetId(storagespace.FormatResourceID(*id)) remoteItem.SetId(storagespace.FormatResourceID(id))
} }
if name := shareStat.GetInfo().GetName(); name != "" { if name := shareStat.GetInfo().GetName(); name != "" {
@@ -228,7 +228,7 @@ func cs3ReceivedSharesToDriveItems(ctx context.Context,
} }
if root := shareStat.GetInfo().GetSpace().GetRoot(); root != nil { if root := shareStat.GetInfo().GetSpace().GetRoot(); root != nil {
parentReference.SetDriveId(storagespace.FormatResourceID(*root)) parentReference.SetDriveId(storagespace.FormatResourceID(root))
} }
if !reflect.ValueOf(*parentReference).IsZero() { if !reflect.ValueOf(*parentReference).IsZero() {
remoteItem.ParentReference = parentReference remoteItem.ParentReference = parentReference
@@ -241,7 +241,7 @@ func cs3ReceivedSharesToDriveItems(ctx context.Context,
driveItem.ParentReference = libregraph.NewItemReference() driveItem.ParentReference = libregraph.NewItemReference()
driveItem.ParentReference.SetDriveType(_spaceTypeVirtual) driveItem.ParentReference.SetDriveType(_spaceTypeVirtual)
driveItem.ParentReference.SetDriveId(storagespace.FormatStorageID(utils.ShareStorageProviderID, utils.ShareStorageSpaceID)) driveItem.ParentReference.SetDriveId(storagespace.FormatStorageID(utils.ShareStorageProviderID, utils.ShareStorageSpaceID))
driveItem.ParentReference.SetId(storagespace.FormatResourceID(storageprovider.ResourceId{ driveItem.ParentReference.SetId(storagespace.FormatResourceID(&storageprovider.ResourceId{
StorageId: utils.ShareStorageProviderID, StorageId: utils.ShareStorageProviderID,
OpaqueId: utils.ShareStorageSpaceID, OpaqueId: utils.ShareStorageSpaceID,
SpaceId: utils.ShareStorageSpaceID, SpaceId: utils.ShareStorageSpaceID,
@@ -383,7 +383,7 @@ func fillDriveItemPropertiesFromReceivedShare(ctx context.Context, logger *log.L
// ID across all services this means we needed to make similar adjustments // ID across all services this means we needed to make similar adjustments
// to the sharejail (usershareprovider, webdav). Which we can't currently do // to the sharejail (usershareprovider, webdav). Which we can't currently do
// as some clients rely on the IDs used there having a special format. // as some clients rely on the IDs used there having a special format.
driveItem.SetId(storagespace.FormatResourceID(storageprovider.ResourceId{ driveItem.SetId(storagespace.FormatResourceID(&storageprovider.ResourceId{
StorageId: utils.ShareStorageProviderID, StorageId: utils.ShareStorageProviderID,
OpaqueId: oldestReceivedShare.GetShare().GetId().GetOpaqueId(), OpaqueId: oldestReceivedShare.GetShare().GetId().GetOpaqueId(),
SpaceId: utils.ShareStorageSpaceID, SpaceId: utils.ShareStorageSpaceID,
@@ -537,7 +537,7 @@ func cs3ReceivedOCMSharesToDriveItems(ctx context.Context,
remoteItem := driveItem.RemoteItem remoteItem := driveItem.RemoteItem
{ {
if id := shareStat.GetInfo().GetId(); id != nil { if id := shareStat.GetInfo().GetId(); id != nil {
remoteItem.SetId(storagespace.FormatResourceID(*id)) remoteItem.SetId(storagespace.FormatResourceID(id))
} }
if name := shareStat.GetInfo().GetName(); name != "" { if name := shareStat.GetInfo().GetName(); name != "" {
@@ -562,7 +562,7 @@ func cs3ReceivedOCMSharesToDriveItems(ctx context.Context,
} }
if root := shareStat.GetInfo().GetSpace().GetRoot(); root != nil { if root := shareStat.GetInfo().GetSpace().GetRoot(); root != nil {
parentReference.SetDriveId(storagespace.FormatResourceID(*root)) parentReference.SetDriveId(storagespace.FormatResourceID(root))
} }
if !reflect.ValueOf(*parentReference).IsZero() { if !reflect.ValueOf(*parentReference).IsZero() {
remoteItem.ParentReference = parentReference remoteItem.ParentReference = parentReference
@@ -575,7 +575,7 @@ func cs3ReceivedOCMSharesToDriveItems(ctx context.Context,
driveItem.ParentReference = libregraph.NewItemReference() driveItem.ParentReference = libregraph.NewItemReference()
driveItem.ParentReference.SetDriveType("virtual") driveItem.ParentReference.SetDriveType("virtual")
driveItem.ParentReference.SetDriveId(storagespace.FormatStorageID(utils.ShareStorageProviderID, utils.ShareStorageSpaceID)) driveItem.ParentReference.SetDriveId(storagespace.FormatStorageID(utils.ShareStorageProviderID, utils.ShareStorageSpaceID))
driveItem.ParentReference.SetId(storagespace.FormatResourceID(storageprovider.ResourceId{ driveItem.ParentReference.SetId(storagespace.FormatResourceID(&storageprovider.ResourceId{
StorageId: utils.ShareStorageProviderID, StorageId: utils.ShareStorageProviderID,
OpaqueId: utils.ShareStorageSpaceID, OpaqueId: utils.ShareStorageSpaceID,
SpaceId: utils.ShareStorageSpaceID, SpaceId: utils.ShareStorageSpaceID,
@@ -721,7 +721,7 @@ func fillDriveItemPropertiesFromReceivedOCMShare(ctx context.Context, logger *lo
// ID across all services this means we needed to make similar adjustments // ID across all services this means we needed to make similar adjustments
// to the sharejail (usershareprovider, webdav). Which we can't currently do // to the sharejail (usershareprovider, webdav). Which we can't currently do
// as some clients rely on the IDs used there having a special format. // as some clients rely on the IDs used there having a special format.
driveItem.SetId(storagespace.FormatResourceID(storageprovider.ResourceId{ driveItem.SetId(storagespace.FormatResourceID(&storageprovider.ResourceId{
StorageId: utils.OCMStorageProviderID, StorageId: utils.OCMStorageProviderID,
SpaceId: utils.OCMStorageSpaceID, SpaceId: utils.OCMStorageSpaceID,
OpaqueId: oldestReceivedShare.GetRemoteShareId(), OpaqueId: oldestReceivedShare.GetRemoteShareId(),
@@ -57,7 +57,7 @@ var _ = Describe("Notifications", func() {
gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient]( gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient](
"GatewaySelector", "GatewaySelector",
"com.owncloud.api.gateway", "com.owncloud.api.gateway",
func(cc *grpc.ClientConn) gateway.GatewayAPIClient { func(cc grpc.ClientConnInterface) gateway.GatewayAPIClient {
return gatewayClient return gatewayClient
}, },
) )
@@ -250,7 +250,7 @@ var _ = Describe("Notifications X-Site Scripting", func() {
gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient]( gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient](
"GatewaySelector", "GatewaySelector",
"com.owncloud.api.gateway", "com.owncloud.api.gateway",
func(cc *grpc.ClientConn) gateway.GatewayAPIClient { func(cc grpc.ClientConnInterface) gateway.GatewayAPIClient {
return gatewayClient return gatewayClient
}, },
) )
@@ -92,7 +92,7 @@ var _ = Describe("Authenticating requests", Label("Authentication"), func() {
RevaGatewaySelector: pool.GetSelector[gateway.GatewayAPIClient]( RevaGatewaySelector: pool.GetSelector[gateway.GatewayAPIClient](
"GatewaySelector", "GatewaySelector",
"com.owncloud.api.gateway", "com.owncloud.api.gateway",
func(cc *grpc.ClientConn) gateway.GatewayAPIClient { func(cc grpc.ClientConnInterface) gateway.GatewayAPIClient {
return mockGatewayClient{ return mockGatewayClient{
AuthenticateFunc: func(authType, clientID, clientSecret string) (string, rpcv1beta1.Code) { AuthenticateFunc: func(authType, clientID, clientSecret string) (string, rpcv1beta1.Code) {
if authType != "publicshares" { if authType != "publicshares" {
@@ -147,7 +147,7 @@ func prepare(q string) (http.Handler, *mocks.PoliciesProviderService, *cs3mocks.
gatewaySelector := pool.GetSelector[gateway.GatewayAPIClient]( gatewaySelector := pool.GetSelector[gateway.GatewayAPIClient](
"GatewaySelector", "GatewaySelector",
"com.owncloud.api.gateway", "com.owncloud.api.gateway",
func(cc *grpc.ClientConn) gateway.GatewayAPIClient { func(cc grpc.ClientConnInterface) gateway.GatewayAPIClient {
return gatewayClient return gatewayClient
}, },
) )
@@ -23,7 +23,7 @@ var _ = Describe("Authenticating requests", Label("PublicShareAuthenticator"), f
RevaGatewaySelector: pool.GetSelector[gateway.GatewayAPIClient]( RevaGatewaySelector: pool.GetSelector[gateway.GatewayAPIClient](
"GatewaySelector", "GatewaySelector",
"com.owncloud.api.gateway", "com.owncloud.api.gateway",
func(cc *grpc.ClientConn) gateway.GatewayAPIClient { func(cc grpc.ClientConnInterface) gateway.GatewayAPIClient {
return mockGatewayClient{ return mockGatewayClient{
AuthenticateFunc: func(authType, clientID, clientSecret string) (string, rpcv1beta1.Code) { AuthenticateFunc: func(authType, clientID, clientSecret string) (string, rpcv1beta1.Code) {
if authType != "publicshares" { if authType != "publicshares" {
@@ -215,6 +215,54 @@ func (_c *UserBackend_GetUserByClaims_Call) RunAndReturn(run func(context.Contex
return _c return _c
} }
// SyncGroupMemberships provides a mock function with given fields: ctx, user, claims
func (_m *UserBackend) SyncGroupMemberships(ctx context.Context, user *userv1beta1.User, claims map[string]interface{}) error {
ret := _m.Called(ctx, user, claims)
if len(ret) == 0 {
panic("no return value specified for SyncGroupMemberships")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *userv1beta1.User, map[string]interface{}) error); ok {
r0 = rf(ctx, user, claims)
} else {
r0 = ret.Error(0)
}
return r0
}
// UserBackend_SyncGroupMemberships_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SyncGroupMemberships'
type UserBackend_SyncGroupMemberships_Call struct {
*mock.Call
}
// SyncGroupMemberships is a helper method to define mock.On call
// - ctx context.Context
// - user *userv1beta1.User
// - claims map[string]interface{}
func (_e *UserBackend_Expecter) SyncGroupMemberships(ctx interface{}, user interface{}, claims interface{}) *UserBackend_SyncGroupMemberships_Call {
return &UserBackend_SyncGroupMemberships_Call{Call: _e.mock.On("SyncGroupMemberships", ctx, user, claims)}
}
func (_c *UserBackend_SyncGroupMemberships_Call) Run(run func(ctx context.Context, user *userv1beta1.User, claims map[string]interface{})) *UserBackend_SyncGroupMemberships_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*userv1beta1.User), args[2].(map[string]interface{}))
})
return _c
}
func (_c *UserBackend_SyncGroupMemberships_Call) Return(_a0 error) *UserBackend_SyncGroupMemberships_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *UserBackend_SyncGroupMemberships_Call) RunAndReturn(run func(context.Context, *userv1beta1.User, map[string]interface{}) error) *UserBackend_SyncGroupMemberships_Call {
_c.Call.Return(run)
return _c
}
// UpdateUserIfNeeded provides a mock function with given fields: ctx, user, claims // UpdateUserIfNeeded provides a mock function with given fields: ctx, user, claims
func (_m *UserBackend) UpdateUserIfNeeded(ctx context.Context, user *userv1beta1.User, claims map[string]interface{}) error { func (_m *UserBackend) UpdateUserIfNeeded(ctx context.Context, user *userv1beta1.User, claims map[string]interface{}) error {
ret := _m.Called(ctx, user, claims) ret := _m.Called(ctx, user, claims)
+1 -1
View File
@@ -146,7 +146,7 @@ func (b *Bleve) Search(ctx context.Context, sir *searchService.SearchIndexReques
&query.TermQuery{ &query.TermQuery{
FieldVal: "RootID", FieldVal: "RootID",
Term: storagespace.FormatResourceID( Term: storagespace.FormatResourceID(
storageProvider.ResourceId{ &storageProvider.ResourceId{
StorageId: sir.Ref.GetResourceId().GetStorageId(), StorageId: sir.Ref.GetResourceId().GetStorageId(),
SpaceId: sir.Ref.GetResourceId().GetSpaceId(), SpaceId: sir.Ref.GetResourceId().GetSpaceId(),
OpaqueId: sir.Ref.GetResourceId().GetOpaqueId(), OpaqueId: sir.Ref.GetResourceId().GetOpaqueId(),
+1 -1
View File
@@ -43,7 +43,7 @@ func HandleEvents(s Searcher, bus events.Consumer, logger log.Logger, cfg *confi
getSpaceID := func(ref *provider.Reference) *provider.StorageSpaceId { getSpaceID := func(ref *provider.Reference) *provider.StorageSpaceId {
return &provider.StorageSpaceId{ return &provider.StorageSpaceId{
OpaqueId: storagespace.FormatResourceID( OpaqueId: storagespace.FormatResourceID(
provider.ResourceId{ &provider.ResourceId{
StorageId: ref.GetResourceId().GetStorageId(), StorageId: ref.GetResourceId().GetStorageId(),
SpaceId: ref.GetResourceId().GetSpaceId(), SpaceId: ref.GetResourceId().GetSpaceId(),
}, },
+8 -8
View File
@@ -167,7 +167,7 @@ func (s *Service) Search(ctx context.Context, req *searchsvc.SearchRequest) (*se
continue continue
} }
opaqueMap := sdk.DecodeOpaqueMap(space.Opaque) opaqueMap := sdk.DecodeOpaqueMap(space.Opaque)
grantSpaceID := storagespace.FormatResourceID(provider.ResourceId{ grantSpaceID := storagespace.FormatResourceID(&provider.ResourceId{
StorageId: opaqueMap["grantStorageID"], StorageId: opaqueMap["grantStorageID"],
SpaceId: opaqueMap["grantSpaceID"], SpaceId: opaqueMap["grantSpaceID"],
OpaqueId: opaqueMap["grantOpaqueID"], OpaqueId: opaqueMap["grantOpaqueID"],
@@ -443,7 +443,7 @@ func (s *Service) IndexSpace(spaceID *provider.StorageSpaceId) error {
s.logger.Debug().Str("path", ref.Path).Msg("Walking tree") s.logger.Debug().Str("path", ref.Path).Msg("Walking tree")
searchRes, err := s.engine.Search(ownerCtx, &searchsvc.SearchIndexRequest{ searchRes, err := s.engine.Search(ownerCtx, &searchsvc.SearchIndexRequest{
Query: "id:" + storagespace.FormatResourceID(*info.Id) + ` mtime>=` + utils.TSToTime(info.Mtime).Format(time.RFC3339Nano), Query: "id:" + storagespace.FormatResourceID(info.Id) + ` mtime>=` + utils.TSToTime(info.Mtime).Format(time.RFC3339Nano),
}) })
if err == nil && len(searchRes.Matches) >= 1 { if err == nil && len(searchRes.Matches) >= 1 {
@@ -471,7 +471,7 @@ func (s *Service) IndexSpace(spaceID *provider.StorageSpaceId) error {
// TrashItem marks the item as deleted. // TrashItem marks the item as deleted.
func (s *Service) TrashItem(rID *provider.ResourceId) { func (s *Service) TrashItem(rID *provider.ResourceId) {
err := s.engine.Delete(storagespace.FormatResourceID(*rID)) err := s.engine.Delete(storagespace.FormatResourceID(rID))
if err != nil { if err != nil {
s.logger.Error().Err(err).Interface("Id", rID).Msg("failed to remove item from index") s.logger.Error().Err(err).Interface("Id", rID).Msg("failed to remove item from index")
} }
@@ -491,8 +491,8 @@ func (s *Service) UpsertItem(ref *provider.Reference) {
} }
r := engine.Resource{ r := engine.Resource{
ID: storagespace.FormatResourceID(*stat.Info.Id), ID: storagespace.FormatResourceID(stat.Info.Id),
RootID: storagespace.FormatResourceID(provider.ResourceId{ RootID: storagespace.FormatResourceID(&provider.ResourceId{
StorageId: stat.Info.Id.StorageId, StorageId: stat.Info.Id.StorageId,
OpaqueId: stat.Info.Id.SpaceId, OpaqueId: stat.Info.Id.SpaceId,
SpaceId: stat.Info.Id.SpaceId, SpaceId: stat.Info.Id.SpaceId,
@@ -504,7 +504,7 @@ func (s *Service) UpsertItem(ref *provider.Reference) {
r.Hidden = strings.HasPrefix(r.Path, ".") r.Hidden = strings.HasPrefix(r.Path, ".")
if parentID := stat.GetInfo().GetParentId(); parentID != nil { if parentID := stat.GetInfo().GetParentId(); parentID != nil {
r.ParentID = storagespace.FormatResourceID(*parentID) r.ParentID = storagespace.FormatResourceID(parentID)
} }
if err = s.engine.Upsert(r.ID, r); err != nil { if err = s.engine.Upsert(r.ID, r); err != nil {
@@ -615,7 +615,7 @@ func (s *Service) RestoreItem(ref *provider.Reference) {
return return
} }
if err := s.engine.Restore(storagespace.FormatResourceID(*stat.Info.Id)); err != nil { if err := s.engine.Restore(storagespace.FormatResourceID(stat.Info.Id)); err != nil {
s.logger.Error().Err(err).Msg("failed to restore the changed resource in the index") s.logger.Error().Err(err).Msg("failed to restore the changed resource in the index")
} }
} }
@@ -627,7 +627,7 @@ func (s *Service) MoveItem(ref *provider.Reference) {
return return
} }
if err := s.engine.Move(storagespace.FormatResourceID(*stat.GetInfo().GetId()), storagespace.FormatResourceID(*stat.GetInfo().GetParentId()), path); err != nil { if err := s.engine.Move(storagespace.FormatResourceID(stat.GetInfo().GetId()), storagespace.FormatResourceID(stat.GetInfo().GetParentId()), path); err != nil {
s.logger.Error().Err(err).Msg("failed to move the changed resource in the index") s.logger.Error().Err(err).Msg("failed to move the changed resource in the index")
} }
} }
+1 -1
View File
@@ -81,7 +81,7 @@ var _ = Describe("Searchprovider", func() {
gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient]( gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient](
"GatewaySelector", "GatewaySelector",
"com.owncloud.api.gateway", "com.owncloud.api.gateway",
func(cc *grpc.ClientConn) gateway.GatewayAPIClient { func(cc grpc.ClientConnInterface) gateway.GatewayAPIClient {
return gatewayClient return gatewayClient
}, },
) )
@@ -53,7 +53,7 @@ var _ = Describe("trash", func() {
gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient]( gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient](
"GatewaySelector", "GatewaySelector",
"com.owncloud.api.gateway", "com.owncloud.api.gateway",
func(cc *grpc.ClientConn) gateway.GatewayAPIClient { func(cc grpc.ClientConnInterface) gateway.GatewayAPIClient {
return gatewayClient return gatewayClient
}, },
) )
+3 -3
View File
@@ -223,7 +223,7 @@ func (c *Converter) shareMessage(eventid string, nt NotificationTemplate, execut
Service: c.serviceName, Service: c.serviceName,
UserName: usr.GetUsername(), UserName: usr.GetUsername(),
Timestamp: ts.Format(time.RFC3339Nano), Timestamp: ts.Format(time.RFC3339Nano),
ResourceID: storagespace.FormatResourceID(*info.GetId()), ResourceID: storagespace.FormatResourceID(info.GetId()),
ResourceType: _resourceTypeShare, ResourceType: _resourceTypeShare,
Subject: subj, Subject: subj,
SubjectRaw: subjraw, SubjectRaw: subjraw,
@@ -257,7 +257,7 @@ func (c *Converter) virusMessage(eventid string, nt NotificationTemplate, execut
Service: c.serviceName, Service: c.serviceName,
UserName: executant.GetUsername(), UserName: executant.GetUsername(),
Timestamp: ts.Format(time.RFC3339Nano), Timestamp: ts.Format(time.RFC3339Nano),
ResourceID: storagespace.FormatResourceID(*rid), ResourceID: storagespace.FormatResourceID(rid),
ResourceType: _resourceTypeResource, ResourceType: _resourceTypeResource,
Subject: subj, Subject: subj,
SubjectRaw: subjraw, SubjectRaw: subjraw,
@@ -415,7 +415,7 @@ func generateDetails(user *user.User, space *storageprovider.StorageSpace, item
if item != nil { if item != nil {
details["resource"] = map[string]string{ details["resource"] = map[string]string{
"id": storagespace.FormatResourceID(*item.GetId()), "id": storagespace.FormatResourceID(item.GetId()),
"name": item.GetName(), "name": item.GetName(),
} }
} }
+1 -1
View File
@@ -59,7 +59,7 @@ var _ = Describe("UserlogService", func() {
gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient]( gatewaySelector = pool.GetSelector[gateway.GatewayAPIClient](
"GatewaySelector", "GatewaySelector",
"com.owncloud.api.gateway", "com.owncloud.api.gateway",
func(cc *grpc.ClientConn) gateway.GatewayAPIClient { func(cc grpc.ClientConnInterface) gateway.GatewayAPIClient {
return gatewayClient return gatewayClient
}, },
) )
@@ -43,7 +43,7 @@ type ThumbnailRequest struct {
} }
func addMissingStorageID(id string) string { func addMissingStorageID(id string) string {
rid := providerv1beta1.ResourceId{} rid := &providerv1beta1.ResourceId{}
rid.StorageId, rid.SpaceId, rid.OpaqueId, _ = storagespace.SplitID(id) rid.StorageId, rid.SpaceId, rid.OpaqueId, _ = storagespace.SplitID(id)
if rid.StorageId == "" && rid.SpaceId == utils.ShareStorageSpaceID { if rid.StorageId == "" && rid.SpaceId == utils.ShareStorageSpaceID {
rid.StorageId = utils.ShareStorageProviderID rid.StorageId = utils.ShareStorageProviderID
+3 -3
View File
@@ -170,13 +170,13 @@ func matchToPropResponse(ctx context.Context, match *searchmsg.Match) (*propfind
Prop: []prop.PropertyXML{}, Prop: []prop.PropertyXML{},
} }
propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:fileid", storagespace.FormatResourceID(provider.ResourceId{ propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:fileid", storagespace.FormatResourceID(&provider.ResourceId{
StorageId: match.Entity.Id.StorageId, StorageId: match.Entity.Id.StorageId,
SpaceId: match.Entity.Id.SpaceId, SpaceId: match.Entity.Id.SpaceId,
OpaqueId: match.Entity.Id.OpaqueId, OpaqueId: match.Entity.Id.OpaqueId,
}))) })))
if match.Entity.ParentId != nil { if match.Entity.ParentId != nil {
propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:file-parent", storagespace.FormatResourceID(provider.ResourceId{ propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:file-parent", storagespace.FormatResourceID(&provider.ResourceId{
StorageId: match.Entity.ParentId.StorageId, StorageId: match.Entity.ParentId.StorageId,
SpaceId: match.Entity.ParentId.SpaceId, SpaceId: match.Entity.ParentId.SpaceId,
OpaqueId: match.Entity.ParentId.OpaqueId, OpaqueId: match.Entity.ParentId.OpaqueId,
@@ -185,7 +185,7 @@ func matchToPropResponse(ctx context.Context, match *searchmsg.Match) (*propfind
if match.Entity.Ref.ResourceId.StorageId == utils.ShareStorageProviderID { if match.Entity.Ref.ResourceId.StorageId == utils.ShareStorageProviderID {
propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:shareid", match.Entity.Ref.ResourceId.OpaqueId)) propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:shareid", match.Entity.Ref.ResourceId.OpaqueId))
propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:shareroot", match.Entity.ShareRootName)) propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:shareroot", match.Entity.ShareRootName))
propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:remote-item-id", storagespace.FormatResourceID(provider.ResourceId{ propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:remote-item-id", storagespace.FormatResourceID(&provider.ResourceId{
StorageId: match.Entity.GetRemoteItemId().GetStorageId(), StorageId: match.Entity.GetRemoteItemId().GetStorageId(),
SpaceId: match.Entity.GetRemoteItemId().GetSpaceId(), SpaceId: match.Entity.GetRemoteItemId().GetSpaceId(),
OpaqueId: match.Entity.GetRemoteItemId().GetOpaqueId(), OpaqueId: match.Entity.GetRemoteItemId().GetOpaqueId(),