diff --git a/services/collaboration/pkg/connector/fileconnector_test.go b/services/collaboration/pkg/connector/fileconnector_test.go index 4a326fe44..74efa85f9 100644 --- a/services/collaboration/pkg/connector/fileconnector_test.go +++ b/services/collaboration/pkg/connector/fileconnector_test.go @@ -13,6 +13,7 @@ import ( auth "github.com/cs3org/go-cs3apis/cs3/auth/provider/v1beta1" gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1" userv1beta1 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" + permissions "github.com/cs3org/go-cs3apis/cs3/permissions/v1beta1" link "github.com/cs3org/go-cs3apis/cs3/sharing/link/v1beta1" providerv1beta1 "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" typesv1beta1 "github.com/cs3org/go-cs3apis/cs3/types/v1beta1" @@ -1800,6 +1801,7 @@ var _ = Describe("FileConnector", func() { BreadcrumbDocName: "test.txt", PostMessageOrigin: "https://cloud.opencloud.test", EnableInsertRemoteImage: true, + IsAnonymousUser: true, } response, err := fc.CheckFileInfo(ctx) @@ -1936,6 +1938,13 @@ var _ = Describe("FileConnector", func() { } ctx = ctxpkg.ContextSetUser(ctx, u) + gatewayClient.On("CheckPermission", mock.Anything, mock.Anything).Return( + &permissions.CheckPermissionResponse{ + Status: status.NewOK(ctx), + }, + nil, + ) + gatewayClient.On("Stat", mock.Anything, mock.Anything).Times(1).Return(&providerv1beta1.StatResponse{ Status: status.NewOK(ctx), Info: &providerv1beta1.ResourceInfo{ @@ -1984,6 +1993,7 @@ var _ = Describe("FileConnector", func() { BreadcrumbDocName: "test.txt", PostMessageOrigin: "https://cloud.opencloud.test", EnableInsertRemoteImage: true, + IsAdminUser: true, } response, err := fc.CheckFileInfo(ctx) @@ -2010,6 +2020,13 @@ var _ = Describe("FileConnector", func() { } ctx = ctxpkg.ContextSetUser(ctx, u) + gatewayClient.On("CheckPermission", mock.Anything, mock.Anything).Return( + &permissions.CheckPermissionResponse{ + Status: status.NewOK(ctx), + }, + nil, + ) + gatewayClient.On("Stat", mock.Anything, mock.Anything).Times(1).Return(&providerv1beta1.StatResponse{ Status: status.NewOK(ctx), Info: &providerv1beta1.ResourceInfo{ diff --git a/services/collaboration/pkg/connector/fileinfo/collabora.go b/services/collaboration/pkg/connector/fileinfo/collabora.go index fc761395b..d23e4e1a4 100644 --- a/services/collaboration/pkg/connector/fileinfo/collabora.go +++ b/services/collaboration/pkg/connector/fileinfo/collabora.go @@ -58,6 +58,8 @@ type Collabora struct { EnableOwnerTermination bool `json:"EnableOwnerTermination,omitempty"` // If set to true, the user has administrator rights in the integration. Some functionality of Collabora Online, such as update check and server audit are supposed to be shown to administrators only. IsAdminUser bool `json:"IsAdminUser"` + // If set to true, some functionality of Collabora which is supposed to be shown to authenticated users only is hidden + IsAnonymousUser bool `json:"IsAnonymousUser,omitempty"` // JSON object that contains additional info about the user, namely the avatar image. //UserExtraInfo -> requires definition, currently not used @@ -135,6 +137,8 @@ func (cinfo *Collabora) SetProperties(props map[string]interface{}) { cinfo.WatermarkText = value.(string) case KeyIsAdminUser: cinfo.IsAdminUser = value.(bool) + case KeyIsAnonymousUser: + cinfo.IsAnonymousUser = value.(bool) case KeyEnableShare: cinfo.EnableShare = value.(bool)