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

update cs3apis, add utility methods for share filters #2044

Merged
merged 1 commit into from
Sep 7, 2021
Merged
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
5 changes: 5 additions & 0 deletions changelog/unreleased/sharing-filter-methods.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Add utility methods for creating share filters

Updated the CS3 API to include the new share grantee filter and added utility methods for creating share filters. This will help making the code more concise.

https://github.com/cs3org/reva/pull/2044
10 changes: 2 additions & 8 deletions cmd/reva/ocm-share-list.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
ocm "github.com/cs3org/go-cs3apis/cs3/sharing/ocm/v1beta1"
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
"github.com/cs3org/reva/pkg/ocm/share"
"github.com/jedib0t/go-pretty/table"
)

Expand Down Expand Up @@ -60,14 +61,7 @@ func ocmShareListCommand() *command {
StorageId: tokens[0],
OpaqueId: tokens[1],
}
shareRequest.Filters = []*ocm.ListOCMSharesRequest_Filter{
{
Type: ocm.ListOCMSharesRequest_Filter_TYPE_RESOURCE_ID,
Term: &ocm.ListOCMSharesRequest_Filter_ResourceId{
ResourceId: id,
},
},
}
shareRequest.Filters = []*ocm.ListOCMSharesRequest_Filter{share.ResourceIDFilter(id)}
}

shareRes, err := shareClient.ListOCMShares(ctx, shareRequest)
Expand Down
10 changes: 2 additions & 8 deletions cmd/reva/public-share-list.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
link "github.com/cs3org/go-cs3apis/cs3/sharing/link/v1beta1"
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
"github.com/cs3org/reva/pkg/publicshare"
"github.com/jedib0t/go-pretty/table"
)

Expand Down Expand Up @@ -60,14 +61,7 @@ func publicShareListCommand() *command {
StorageId: tokens[0],
OpaqueId: tokens[1],
}
shareRequest.Filters = []*link.ListPublicSharesRequest_Filter{
{
Type: link.ListPublicSharesRequest_Filter_TYPE_RESOURCE_ID,
Term: &link.ListPublicSharesRequest_Filter_ResourceId{
ResourceId: id,
},
},
}
shareRequest.Filters = []*link.ListPublicSharesRequest_Filter{publicshare.ResourceIDFilter(id)}
}

shareRes, err := shareClient.ListPublicShares(ctx, shareRequest)
Expand Down
10 changes: 2 additions & 8 deletions cmd/reva/share-list.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
collaboration "github.com/cs3org/go-cs3apis/cs3/sharing/collaboration/v1beta1"
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
"github.com/cs3org/reva/pkg/share"
"github.com/jedib0t/go-pretty/table"
)

Expand Down Expand Up @@ -60,14 +61,7 @@ func shareListCommand() *command {
StorageId: tokens[0],
OpaqueId: tokens[1],
}
shareRequest.Filters = []*collaboration.ListSharesRequest_Filter{
{
Type: collaboration.ListSharesRequest_Filter_TYPE_RESOURCE_ID,
Term: &collaboration.ListSharesRequest_Filter_ResourceId{
ResourceId: id,
},
},
}
shareRequest.Filters = []*collaboration.Filter{share.ResourceIDFilter(id)}
}

shareRes, err := shareClient.ListShares(ctx, shareRequest)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/cheggaaa/pb v1.0.29
github.com/coreos/go-oidc v2.2.1+incompatible
github.com/cs3org/cato v0.0.0-20200828125504-e418fc54dd5e
github.com/cs3org/go-cs3apis v0.0.0-20210812121411-f18cf19614e8
github.com/cs3org/go-cs3apis v0.0.0-20210906133842-03e4a408c1f3
github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8
github.com/eventials/go-tus v0.0.0-20200718001131-45c7ec8f5d59
github.com/gdexlab/go-render v1.0.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ github.com/cs3org/cato v0.0.0-20200828125504-e418fc54dd5e h1:tqSPWQeueWTKnJVMJff
github.com/cs3org/cato v0.0.0-20200828125504-e418fc54dd5e/go.mod h1:XJEZ3/EQuI3BXTp/6DUzFr850vlxq11I6satRtz0YQ4=
github.com/cs3org/go-cs3apis v0.0.0-20210812121411-f18cf19614e8 h1:bqUkE0l5wD62TKH6HkbSVYwyYzZ0PIeak/hnW7ggUdU=
github.com/cs3org/go-cs3apis v0.0.0-20210812121411-f18cf19614e8/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY=
github.com/cs3org/go-cs3apis v0.0.0-20210906133842-03e4a408c1f3 h1:NcLk09WK4wx/iIrEI+7ZFbr78APaRKJxF0+zl6kv4is=
github.com/cs3org/go-cs3apis v0.0.0-20210906133842-03e4a408c1f3/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY=
github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8 h1:Z9lwXumT5ACSmJ7WGnFl+OMLLjpz5uR2fyz7dC255FI=
github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8/go.mod h1:4abs/jPXcmJzYoYGF91JF9Uq9s/KL5n1jvFDix8KcqY=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func (s *service) UpdateShare(ctx context.Context, req *collaboration.UpdateShar
}

func (s *service) ListReceivedShares(ctx context.Context, req *collaboration.ListReceivedSharesRequest) (*collaboration.ListReceivedSharesResponse, error) {
shares, err := s.sm.ListReceivedShares(ctx) // TODO(labkode): check what to update
shares, err := s.sm.ListReceivedShares(ctx, req.Filters) // TODO(labkode): check what to update
if err != nil {
return &collaboration.ListReceivedSharesResponse{
Status: status.NewInternal(ctx, err, "error listing received shares"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ import (
"github.com/cs3org/reva/internal/http/services/owncloud/ocs/conversions"
"github.com/cs3org/reva/internal/http/services/owncloud/ocs/response"
"github.com/cs3org/reva/pkg/appctx"
"github.com/cs3org/reva/pkg/publicshare"
"github.com/cs3org/reva/pkg/rgrpc/todo/pool"
"github.com/cs3org/reva/pkg/share"
"github.com/cs3org/reva/pkg/share/cache"
"github.com/cs3org/reva/pkg/share/cache/registry"
"github.com/cs3org/reva/pkg/utils"
Expand Down Expand Up @@ -607,7 +609,7 @@ func (h *Handler) listSharesWithMe(w http.ResponseWriter, r *http.Request) {
func (h *Handler) listSharesWithOthers(w http.ResponseWriter, r *http.Request) {
shares := make([]*conversions.ShareData, 0)

filters := []*collaboration.ListSharesRequest_Filter{}
filters := []*collaboration.Filter{}
linkFilters := []*link.ListPublicSharesRequest_Filter{}
var e error

Expand Down Expand Up @@ -663,8 +665,8 @@ func (h *Handler) logProblems(s *rpc.Status, e error, msg string) {
}
}

func (h *Handler) addFilters(w http.ResponseWriter, r *http.Request, prefix string) ([]*collaboration.ListSharesRequest_Filter, []*link.ListPublicSharesRequest_Filter, error) {
collaborationFilters := []*collaboration.ListSharesRequest_Filter{}
func (h *Handler) addFilters(w http.ResponseWriter, r *http.Request, prefix string) ([]*collaboration.Filter, []*link.ListPublicSharesRequest_Filter, error) {
collaborationFilters := []*collaboration.Filter{}
linkFilters := []*link.ListPublicSharesRequest_Filter{}
ctx := r.Context()

Expand Down Expand Up @@ -692,19 +694,9 @@ func (h *Handler) addFilters(w http.ResponseWriter, r *http.Request, prefix stri
return nil, nil, err
}

collaborationFilters = append(collaborationFilters, &collaboration.ListSharesRequest_Filter{
Type: collaboration.ListSharesRequest_Filter_TYPE_RESOURCE_ID,
Term: &collaboration.ListSharesRequest_Filter_ResourceId{
ResourceId: info.Id,
},
})
collaborationFilters = append(collaborationFilters, share.ResourceIDFilter(info.Id))

linkFilters = append(linkFilters, &link.ListPublicSharesRequest_Filter{
Type: link.ListPublicSharesRequest_Filter_TYPE_RESOURCE_ID,
Term: &link.ListPublicSharesRequest_Filter_ResourceId{
ResourceId: info.Id,
},
})
linkFilters = append(linkFilters, publicshare.ResourceIDFilter(info.Id))

return collaborationFilters, linkFilters, nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (h *Handler) removeUserShare(w http.ResponseWriter, r *http.Request, shareI
response.WriteOCSSuccess(w, r, nil)
}

func (h *Handler) listUserShares(r *http.Request, filters []*collaboration.ListSharesRequest_Filter) ([]*conversions.ShareData, *rpc.Status, error) {
func (h *Handler) listUserShares(r *http.Request, filters []*collaboration.Filter) ([]*conversions.ShareData, *rpc.Status, error) {
ctx := r.Context()
log := appctx.GetLogger(ctx)

Expand Down
6 changes: 3 additions & 3 deletions pkg/cbox/share/sql/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,13 @@ func (m *mgr) UpdateShare(ctx context.Context, ref *collaboration.ShareReference
return m.GetShare(ctx, ref)
}

func (m *mgr) ListShares(ctx context.Context, filters []*collaboration.ListSharesRequest_Filter) ([]*collaboration.Share, error) {
func (m *mgr) ListShares(ctx context.Context, filters []*collaboration.Filter) ([]*collaboration.Share, error) {
uid := conversions.FormatUserID(ctxpkg.ContextMustGetUser(ctx).Id)
query := "select coalesce(uid_owner, '') as uid_owner, coalesce(uid_initiator, '') as uid_initiator, coalesce(share_with, '') as share_with, coalesce(fileid_prefix, '') as fileid_prefix, coalesce(item_source, '') as item_source, id, stime, permissions, share_type FROM oc_share WHERE (orphan = 0 or orphan IS NULL) AND (uid_owner=? or uid_initiator=?) AND (share_type=? OR share_type=?)"
var filterQuery string
params := []interface{}{uid, uid, 0, 1}
for i, f := range filters {
if f.Type == collaboration.ListSharesRequest_Filter_TYPE_RESOURCE_ID {
if f.Type == collaboration.Filter_TYPE_RESOURCE_ID {
filterQuery += "(fileid_prefix=? AND item_source=?)"
if i != len(filters)-1 {
filterQuery += " AND "
Expand Down Expand Up @@ -314,7 +314,7 @@ func (m *mgr) ListShares(ctx context.Context, filters []*collaboration.ListShare
}

// we list the shares that are targeted to the user in context or to the user groups.
func (m *mgr) ListReceivedShares(ctx context.Context) ([]*collaboration.ReceivedShare, error) {
func (m *mgr) ListReceivedShares(ctx context.Context, filters []*collaboration.Filter) ([]*collaboration.ReceivedShare, error) {
user := ctxpkg.ContextMustGetUser(ctx)
uid := conversions.FormatUserID(user.Id)

Expand Down
10 changes: 10 additions & 0 deletions pkg/ocm/share/share.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,13 @@ type Manager interface {
// UpdateReceivedShare updates the received share with share state.
UpdateReceivedShare(ctx context.Context, ref *ocm.ShareReference, f *ocm.UpdateReceivedOCMShareRequest_UpdateField) (*ocm.ReceivedShare, error)
}

// ResourceIDFilter is an abstraction for creating filter by resource id.
func ResourceIDFilter(id *provider.ResourceId) *ocm.ListOCMSharesRequest_Filter {
return &ocm.ListOCMSharesRequest_Filter{
Type: ocm.ListOCMSharesRequest_Filter_TYPE_RESOURCE_ID,
Term: &ocm.ListOCMSharesRequest_Filter_ResourceId{
ResourceId: id,
},
}
}
10 changes: 10 additions & 0 deletions pkg/publicshare/publicshare.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,13 @@ func AddSignature(share *link.PublicShare, pw string) error {
}
return nil
}

// ResourceIDFilter is an abstraction for creating filter by resource id.
func ResourceIDFilter(id *provider.ResourceId) *link.ListPublicSharesRequest_Filter {
return &link.ListPublicSharesRequest_Filter{
Type: link.ListPublicSharesRequest_Filter_TYPE_RESOURCE_ID,
Term: &link.ListPublicSharesRequest_Filter_ResourceId{
ResourceId: id,
},
}
}
6 changes: 3 additions & 3 deletions pkg/share/manager/json/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ func (m *mgr) UpdateShare(ctx context.Context, ref *collaboration.ShareReference
return nil, errtypes.NotFound(ref.String())
}

func (m *mgr) ListShares(ctx context.Context, filters []*collaboration.ListSharesRequest_Filter) ([]*collaboration.Share, error) {
func (m *mgr) ListShares(ctx context.Context, filters []*collaboration.Filter) ([]*collaboration.Share, error) {
var ss []*collaboration.Share
m.Lock()
defer m.Unlock()
Expand All @@ -368,7 +368,7 @@ func (m *mgr) ListShares(ctx context.Context, filters []*collaboration.ListShare
// check filters
// TODO(labkode): add the rest of filters.
for _, f := range filters {
if f.Type == collaboration.ListSharesRequest_Filter_TYPE_RESOURCE_ID {
if f.Type == collaboration.Filter_TYPE_RESOURCE_ID {
if utils.ResourceIDEqual(s.ResourceId, f.GetResourceId()) {
ss = append(ss, s)
}
Expand All @@ -381,7 +381,7 @@ func (m *mgr) ListShares(ctx context.Context, filters []*collaboration.ListShare
}

// we list the shares that are targeted to the user in context or to the user groups.
func (m *mgr) ListReceivedShares(ctx context.Context) ([]*collaboration.ReceivedShare, error) {
func (m *mgr) ListReceivedShares(ctx context.Context, filters []*collaboration.Filter) ([]*collaboration.ReceivedShare, error) {
var rss []*collaboration.ReceivedShare
m.Lock()
defer m.Unlock()
Expand Down
6 changes: 3 additions & 3 deletions pkg/share/manager/memory/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ func (m *manager) UpdateShare(ctx context.Context, ref *collaboration.ShareRefer
return nil, errtypes.NotFound(ref.String())
}

func (m *manager) ListShares(ctx context.Context, filters []*collaboration.ListSharesRequest_Filter) ([]*collaboration.Share, error) {
func (m *manager) ListShares(ctx context.Context, filters []*collaboration.Filter) ([]*collaboration.Share, error) {
var ss []*collaboration.Share
m.lock.Lock()
defer m.lock.Unlock()
Expand All @@ -229,7 +229,7 @@ func (m *manager) ListShares(ctx context.Context, filters []*collaboration.ListS
// check filters
// TODO(labkode): add the rest of filters.
for _, f := range filters {
if f.Type == collaboration.ListSharesRequest_Filter_TYPE_RESOURCE_ID {
if f.Type == collaboration.Filter_TYPE_RESOURCE_ID {
if utils.ResourceIDEqual(s.ResourceId, f.GetResourceId()) {
ss = append(ss, s)
}
Expand All @@ -242,7 +242,7 @@ func (m *manager) ListShares(ctx context.Context, filters []*collaboration.ListS
}

// we list the shares that are targeted to the user in context or to the user groups.
func (m *manager) ListReceivedShares(ctx context.Context) ([]*collaboration.ReceivedShare, error) {
func (m *manager) ListReceivedShares(ctx context.Context, filters []*collaboration.Filter) ([]*collaboration.ReceivedShare, error) {
var rss []*collaboration.ReceivedShare
m.lock.Lock()
defer m.lock.Unlock()
Expand Down
6 changes: 3 additions & 3 deletions pkg/share/manager/sql/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,13 @@ func (m *mgr) UpdateShare(ctx context.Context, ref *collaboration.ShareReference
return m.GetShare(ctx, ref)
}

func (m *mgr) ListShares(ctx context.Context, filters []*collaboration.ListSharesRequest_Filter) ([]*collaboration.Share, error) {
func (m *mgr) ListShares(ctx context.Context, filters []*collaboration.Filter) ([]*collaboration.Share, error) {
uid := ctxpkg.ContextMustGetUser(ctx).Username
query := "select coalesce(uid_owner, '') as uid_owner, coalesce(uid_initiator, '') as uid_initiator, coalesce(share_with, '') as share_with, coalesce(item_source, '') as item_source, id, stime, permissions, share_type FROM oc_share WHERE (uid_owner=? or uid_initiator=?) AND (share_type=? OR share_type=?)"
var filterQuery string
params := []interface{}{uid, uid, 0, 1}
for i, f := range filters {
if f.Type == collaboration.ListSharesRequest_Filter_TYPE_RESOURCE_ID {
if f.Type == collaboration.Filter_TYPE_RESOURCE_ID {
filterQuery += "(item_source=?)"
if i != len(filters)-1 {
filterQuery += " AND "
Expand Down Expand Up @@ -315,7 +315,7 @@ func (m *mgr) ListShares(ctx context.Context, filters []*collaboration.ListShare
}

// we list the shares that are targeted to the user in context or to the user groups.
func (m *mgr) ListReceivedShares(ctx context.Context) ([]*collaboration.ReceivedShare, error) {
func (m *mgr) ListReceivedShares(ctx context.Context, filters []*collaboration.Filter) ([]*collaboration.ReceivedShare, error) {
user := ctxpkg.ContextMustGetUser(ctx)
uid := user.Username

Expand Down
23 changes: 9 additions & 14 deletions pkg/share/manager/sql/sql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,20 +165,15 @@ var _ = Describe("SQL manager", func() {

Describe("ListShares", func() {
It("lists shares", func() {
shares, err := mgr.ListShares(ctx, []*collaboration.ListSharesRequest_Filter{})
shares, err := mgr.ListShares(ctx, []*collaboration.Filter{})
Expect(err).ToNot(HaveOccurred())
Expect(len(shares)).To(Equal(1))

shares, err = mgr.ListShares(ctx, []*collaboration.ListSharesRequest_Filter{
{
Type: collaboration.ListSharesRequest_Filter_TYPE_RESOURCE_ID,
Term: &collaboration.ListSharesRequest_Filter_ResourceId{
ResourceId: &provider.ResourceId{
StorageId: "/",
OpaqueId: "somethingElse",
},
},
},
shares, err = mgr.ListShares(ctx, []*collaboration.Filter{
share.ResourceIDFilter(&provider.ResourceId{
StorageId: "/",
OpaqueId: "somethingElse",
}),
})
Expect(err).ToNot(HaveOccurred())
Expect(len(shares)).To(Equal(0))
Expand All @@ -188,7 +183,7 @@ var _ = Describe("SQL manager", func() {
Describe("ListReceivedShares", func() {
It("lists received shares", func() {
loginAs(otherUser)
shares, err := mgr.ListReceivedShares(ctx)
shares, err := mgr.ListReceivedShares(ctx, []*collaboration.Filter{})
Expect(err).ToNot(HaveOccurred())
Expect(len(shares)).To(Equal(1))
})
Expand Down Expand Up @@ -230,7 +225,7 @@ var _ = Describe("SQL manager", func() {
Describe("Unshare", func() {
It("deletes shares", func() {
loginAs(otherUser)
shares, err := mgr.ListReceivedShares(ctx)
shares, err := mgr.ListReceivedShares(ctx, []*collaboration.Filter{})
Expect(err).ToNot(HaveOccurred())
Expect(len(shares)).To(Equal(1))

Expand All @@ -243,7 +238,7 @@ var _ = Describe("SQL manager", func() {
Expect(err).ToNot(HaveOccurred())

loginAs(otherUser)
shares, err = mgr.ListReceivedShares(ctx)
shares, err = mgr.ListReceivedShares(ctx, []*collaboration.Filter{})
Expect(err).ToNot(HaveOccurred())
Expect(len(shares)).To(Equal(0))
})
Expand Down
34 changes: 32 additions & 2 deletions pkg/share/share.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,44 @@ type Manager interface {

// ListShares returns the shares created by the user. If md is provided is not nil,
// it returns only shares attached to the given resource.
ListShares(ctx context.Context, filters []*collaboration.ListSharesRequest_Filter) ([]*collaboration.Share, error)
ListShares(ctx context.Context, filters []*collaboration.Filter) ([]*collaboration.Share, error)

// ListReceivedShares returns the list of shares the user has access.
ListReceivedShares(ctx context.Context) ([]*collaboration.ReceivedShare, error)
ListReceivedShares(ctx context.Context, filters []*collaboration.Filter) ([]*collaboration.ReceivedShare, error)

// GetReceivedShare returns the information for a received share the user has access.
GetReceivedShare(ctx context.Context, ref *collaboration.ShareReference) (*collaboration.ReceivedShare, error)

// UpdateReceivedShare updates the received share with share state.
UpdateReceivedShare(ctx context.Context, ref *collaboration.ShareReference, f *collaboration.UpdateReceivedShareRequest_UpdateField) (*collaboration.ReceivedShare, error)
}

// GroupGranteeFilter is an abstraction for creating filter by grantee type group.
func GroupGranteeFilter() *collaboration.Filter {
return &collaboration.Filter{
Type: collaboration.Filter_TYPE_GRANTEE_TYPE,
Term: &collaboration.Filter_GranteeType{
GranteeType: provider.GranteeType_GRANTEE_TYPE_GROUP,
},
}
}

// UserGranteeFilter is an abstraction for creating filter by grantee type user.
func UserGranteeFilter() *collaboration.Filter {
return &collaboration.Filter{
Type: collaboration.Filter_TYPE_GRANTEE_TYPE,
Term: &collaboration.Filter_GranteeType{
GranteeType: provider.GranteeType_GRANTEE_TYPE_USER,
},
}
}

// ResourceIDFilter is an abstraction for creating filter by resource id.
func ResourceIDFilter(id *provider.ResourceId) *collaboration.Filter {
return &collaboration.Filter{
Type: collaboration.Filter_TYPE_RESOURCE_ID,
Term: &collaboration.Filter_ResourceId{
ResourceId: id,
},
}
}