-
Notifications
You must be signed in to change notification settings - Fork 3
feat: Separate the storage-users and graph to handle vault storage #559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,7 @@ import ( | |
| providerpb "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" | ||
| registrypb "github.com/cs3org/go-cs3apis/cs3/storage/registry/v1beta1" | ||
| typesv1beta1 "github.com/cs3org/go-cs3apis/cs3/types/v1beta1" | ||
| "github.com/mitchellh/mapstructure" | ||
| "github.com/owncloud/reva/v2/pkg/appctx" | ||
| ctxpkg "github.com/owncloud/reva/v2/pkg/ctx" | ||
| "github.com/owncloud/reva/v2/pkg/errtypes" | ||
|
|
@@ -44,7 +45,6 @@ import ( | |
| pkgregistry "github.com/owncloud/reva/v2/pkg/storage/registry/registry" | ||
| "github.com/owncloud/reva/v2/pkg/storagespace" | ||
| "github.com/owncloud/reva/v2/pkg/utils" | ||
| "github.com/mitchellh/mapstructure" | ||
| "google.golang.org/grpc" | ||
| ) | ||
|
|
||
|
|
@@ -195,6 +195,18 @@ func (r *registry) GetProvider(ctx context.Context, space *providerpb.StorageSpa | |
| if space.SpaceType != "" && spaceType != space.SpaceType { | ||
| continue | ||
| } | ||
|
|
||
| // Filter out vault spaces if no storageId is provided | ||
| if space.GetRoot().GetStorageId() != "" { | ||
| if space.GetRoot().GetStorageId() != provider.ProviderID { | ||
| continue | ||
| } | ||
| } else { | ||
| if strings.HasPrefix(sc.MountPoint, "/vault/") { | ||
| continue | ||
| } | ||
| } | ||
|
Comment on lines
+199
to
+208
|
||
|
|
||
| if space.Owner != nil { | ||
| user := ctxpkg.ContextMustGetUser(ctx) | ||
| spacePath, err = sc.SpacePath(user, space) | ||
|
|
@@ -289,7 +301,7 @@ func (r *registry) ListProviders(ctx context.Context, filters map[string]string) | |
| // return all providers | ||
| return r.findAllProviders(ctx, mask), nil | ||
| default: | ||
| return r.findProvidersForFilter(ctx, r.buildFilters(filters), unrestricted, mask), nil | ||
| return r.findProvidersForFilter(ctx, r.buildFilters(filters), filters["storage_id"], unrestricted, mask), nil | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -340,7 +352,7 @@ func (r *registry) buildFilters(filterMap map[string]string) []*providerpb.ListS | |
| return filters | ||
| } | ||
|
|
||
| func (r *registry) findProvidersForFilter(ctx context.Context, filters []*providerpb.ListStorageSpacesRequest_Filter, unrestricted bool, _ string) []*registrypb.ProviderInfo { | ||
| func (r *registry) findProvidersForFilter(ctx context.Context, filters []*providerpb.ListStorageSpacesRequest_Filter, storageId string, unrestricted bool, _ string) []*registrypb.ProviderInfo { | ||
|
|
||
| var requestedSpaceType string | ||
| for _, f := range filters { | ||
|
|
@@ -352,7 +364,10 @@ func (r *registry) findProvidersForFilter(ctx context.Context, filters []*provid | |
| currentUser := ctxpkg.ContextMustGetUser(ctx) | ||
| providerInfos := []*registrypb.ProviderInfo{} | ||
| for address, provider := range r.c.Providers { | ||
|
|
||
| // skip mismatching storageproviders | ||
| if storageId != "" && storageId != provider.ProviderID { | ||
| continue | ||
| } | ||
| // when a specific space type is requested we may skip this provider altogether if it is not configured for that type | ||
| // we have to ignore a space type filter with +grant or +mountpoint type because they can live on any provider | ||
| if requestedSpaceType != "" && !strings.HasPrefix(requestedSpaceType, "+") { | ||
|
|
@@ -385,6 +400,10 @@ func (r *registry) findProvidersForFilter(ctx context.Context, filters []*provid | |
| if sc, ok = provider.Spaces[space.SpaceType]; !ok { | ||
| continue | ||
| } | ||
| // Filter out vault spaces if no storageId is provided | ||
| if storageId == "" && strings.HasPrefix(sc.MountPoint, "/vault/") { | ||
| continue | ||
| } | ||
|
Comment on lines
+403
to
+406
|
||
| spacePath, err = sc.SpacePath(currentUser, space) | ||
| if err != nil { | ||
| appctx.GetLogger(ctx).Error().Err(err).Interface("provider", provider).Interface("space", space).Msg("failed to execute template, continuing") | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.