Skip to content
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

fix app provider on public links #2443

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions internal/grpc/interceptors/auth/scope.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ func expandAndVerifyScope(ctx context.Context, req interface{}, tokenScope map[s
}
}
}
} else if _, ok := listStorageSpaces(req); ok {
return nil
}

return errtypes.PermissionDenied("access to resource not allowed within the assigned scope")
Expand Down Expand Up @@ -245,13 +247,13 @@ func extractRef(req interface{}, hasEditorRole bool) (*provider.Reference, bool)
case *provider.InitiateFileDownloadRequest:
return v.GetRef(), true
case *appprovider.OpenInAppRequest:
return &provider.Reference{ResourceId: v.ResourceInfo.Id}, true
return &provider.Reference{ResourceId: v.ResourceInfo.Id, Path: "."}, true
case *gateway.OpenInAppRequest:
return v.GetRef(), true

// App provider requests
case *appregistry.GetAppProvidersRequest:
return &provider.Reference{ResourceId: v.ResourceInfo.Id}, true
return &provider.Reference{ResourceId: v.ResourceInfo.Id, Path: "."}, true
}

if !hasEditorRole {
Expand Down Expand Up @@ -288,3 +290,16 @@ func extractShareRef(req interface{}) (*collaboration.ShareReference, bool) {
}
return nil, false
}

func listStorageSpaces(req interface{}) (*provider.ListStorageSpacesRequest, bool) {
switch req.(type) {
case *provider.ListStorageSpacesRequest:
// TODO: checks
return nil, true
case *registry.ListStorageProvidersRequest:
// TODO: checks
return nil, true
default:
return nil, false
}
}
1 change: 1 addition & 0 deletions internal/http/services/appprovider/appprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ func (s *svc) handleOpen(w http.ResponseWriter, r *http.Request) {

fileRef := &provider.Reference{
ResourceId: resourceID,
Path: ".",
}

statRes, err := client.Stat(ctx, &provider.StatRequest{Ref: fileRef})
Expand Down