Skip to content

Commit

Permalink
Add a sharesstorageprovider
Browse files Browse the repository at this point in the history
The provider exposes all received shares. It can be mounted to /home/Shares
to make a lot of special cases for shares handling in the gateway and
storage drivers superfluous.

Add missing mock file

Implement methods for setting/unsetting arbitrary metadata

Fix tests

Adapt to changes from rebase

Fix creating references with embedded mounts

Fix corner cases when stating shares

Allow moves between shares on the same storage

Make the storage rules known to the gateway as well

Do not choke on non-existent shares

Reject a share when it is being deleted

Fix rebase artifacts

WIP: Refactor statting shares. Merge shares permissions.

update after rebase, fix tests

Signed-off-by: Jörn Friedrich Dreyer <[email protected]>

list all shares

Signed-off-by: Jörn Friedrich Dreyer <[email protected]>

work on api change

Signed-off-by: Jörn Friedrich Dreyer <[email protected]>

Fix build

Persist mountpoints in the share managers followin the new cs3 api

Add support for renaming shares in the SharesStorageprovider

Adapt commands for updating received shares

Regenerate the share manager mock

Fix linter warning

Do not raise an internal error when trying to access non-existent shares

Make hound happy

Fix wrong column name in query

Fix typo

Do not confuse user and group names

Add test for listing received group shares

Do not list parent group shares if there is a child share for it already

Make hound happy

Hide the fact that accepted groups shares can be child shares in the db

list shares using the shares manager + hide group shares when the same resource has a user and group share

refactor all the ocs error writing from the new code

Only collide with mountpoints of shares pointing do different resources

Also return shares being shared with one of the user's groups

Add sharesstorageprovider service file for local acceptance tests

Adapt nextcloud share manager to new method signature

Also remove the test for UpdateReceivedShare which can not be tested
anymore with the new signature. The ReceivedShare never held the display
name that's being tested so the test only passed on the data from the
update field, but since the method only takes the actual received share
now this is no longer possible.

WIP: use go-cs3apis fork until it has been merged

Add placeholder changelog to make CI run

Tweak documentation on how to run the acceptance tests

Add missing storage registry rule for the sharesstorageprovider

Fix revad config for local acceptance tests

Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
  • Loading branch information
aduffeck authored and butonic committed Oct 5, 2021
1 parent d7e2e9f commit d080fdd
Show file tree
Hide file tree
Showing 33 changed files with 3,091 additions and 1,555 deletions.
1 change: 1 addition & 0 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,7 @@ def ocisIntegrationTests(parallelRuns, skipExceptParts = []):
"/drone/src/cmd/revad/revad -c storage-home-ocis.toml &",
"/drone/src/cmd/revad/revad -c storage-oc-ocis.toml &",
"/drone/src/cmd/revad/revad -c storage-publiclink-ocis.toml &",
"/drone/src/cmd/revad/revad -c storage-shares-ocis.toml &",
"/drone/src/cmd/revad/revad -c ldap-users.toml",
],
},
Expand Down
10 changes: 0 additions & 10 deletions internal/grpc/services/gateway/appprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,7 @@ func (s *svc) OpenInApp(ctx context.Context, req *gateway.OpenInAppRequest) (*pr
}, nil
}

if s.isSharedFolder(ctx, p) {
return &providerpb.OpenInAppResponse{
Status: status.NewInvalid(ctx, "gateway: can't open shares folder"),
}, nil
}

resName, resChild := p, ""
if s.isShareChild(ctx, p) {
resName, resChild = s.splitShare(ctx, p)
}

statRes, err := s.stat(ctx, &storageprovider.StatRequest{
Ref: &storageprovider.Reference{Path: resName},
})
Expand Down
43 changes: 22 additions & 21 deletions internal/grpc/services/gateway/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,28 @@ func init() {
}

type config struct {
AuthRegistryEndpoint string `mapstructure:"authregistrysvc"`
ApplicationAuthEndpoint string `mapstructure:"applicationauthsvc"`
StorageRegistryEndpoint string `mapstructure:"storageregistrysvc"`
AppRegistryEndpoint string `mapstructure:"appregistrysvc"`
PreferencesEndpoint string `mapstructure:"preferencessvc"`
UserShareProviderEndpoint string `mapstructure:"usershareprovidersvc"`
PublicShareProviderEndpoint string `mapstructure:"publicshareprovidersvc"`
OCMShareProviderEndpoint string `mapstructure:"ocmshareprovidersvc"`
OCMInviteManagerEndpoint string `mapstructure:"ocminvitemanagersvc"`
OCMProviderAuthorizerEndpoint string `mapstructure:"ocmproviderauthorizersvc"`
OCMCoreEndpoint string `mapstructure:"ocmcoresvc"`
UserProviderEndpoint string `mapstructure:"userprovidersvc"`
GroupProviderEndpoint string `mapstructure:"groupprovidersvc"`
DataTxEndpoint string `mapstructure:"datatx"`
DataGatewayEndpoint string `mapstructure:"datagateway"`
CommitShareToStorageGrant bool `mapstructure:"commit_share_to_storage_grant"`
CommitShareToStorageRef bool `mapstructure:"commit_share_to_storage_ref"`
DisableHomeCreationOnLogin bool `mapstructure:"disable_home_creation_on_login"`
TransferSharedSecret string `mapstructure:"transfer_shared_secret"`
TransferExpires int64 `mapstructure:"transfer_expires"`
TokenManager string `mapstructure:"token_manager"`
StorageRules map[string]map[string]interface{} `mapstructure:"storage_rules"`
AuthRegistryEndpoint string `mapstructure:"authregistrysvc"`
ApplicationAuthEndpoint string `mapstructure:"applicationauthsvc"`
StorageRegistryEndpoint string `mapstructure:"storageregistrysvc"`
AppRegistryEndpoint string `mapstructure:"appregistrysvc"`
PreferencesEndpoint string `mapstructure:"preferencessvc"`
UserShareProviderEndpoint string `mapstructure:"usershareprovidersvc"`
PublicShareProviderEndpoint string `mapstructure:"publicshareprovidersvc"`
OCMShareProviderEndpoint string `mapstructure:"ocmshareprovidersvc"`
OCMInviteManagerEndpoint string `mapstructure:"ocminvitemanagersvc"`
OCMProviderAuthorizerEndpoint string `mapstructure:"ocmproviderauthorizersvc"`
OCMCoreEndpoint string `mapstructure:"ocmcoresvc"`
UserProviderEndpoint string `mapstructure:"userprovidersvc"`
GroupProviderEndpoint string `mapstructure:"groupprovidersvc"`
DataTxEndpoint string `mapstructure:"datatx"`
DataGatewayEndpoint string `mapstructure:"datagateway"`
CommitShareToStorageGrant bool `mapstructure:"commit_share_to_storage_grant"`
CommitShareToStorageRef bool `mapstructure:"commit_share_to_storage_ref"`
DisableHomeCreationOnLogin bool `mapstructure:"disable_home_creation_on_login"`
TransferSharedSecret string `mapstructure:"transfer_shared_secret"`
TransferExpires int64 `mapstructure:"transfer_expires"`
TokenManager string `mapstructure:"token_manager"`
// ShareFolder is the location where to create shares in the recipient's storage provider.
ShareFolder string `mapstructure:"share_folder"`
DataTransfersFolder string `mapstructure:"data_transfers_folder"`
Expand Down
5 changes: 0 additions & 5 deletions internal/grpc/services/gateway/publicshareprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,11 @@ import (
rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
link "github.com/cs3org/go-cs3apis/cs3/sharing/link/v1beta1"
"github.com/cs3org/reva/pkg/appctx"
"github.com/cs3org/reva/pkg/errtypes"
"github.com/cs3org/reva/pkg/rgrpc/todo/pool"
"github.com/pkg/errors"
)

func (s *svc) CreatePublicShare(ctx context.Context, req *link.CreatePublicShareRequest) (*link.CreatePublicShareResponse, error) {
if s.isSharedFolder(ctx, req.ResourceInfo.GetPath()) {
return nil, errtypes.AlreadyExists("gateway: can't create a public share of the share folder itself")
}

log := appctx.GetLogger(ctx)
log.Info().Msg("create public share")

Expand Down
Loading

0 comments on commit d080fdd

Please sign in to comment.