Skip to content

Commit 63d8340

Browse files
authored
remove business+ dependency for getting workspace role grants (#70)
1 parent b44d836 commit 63d8340

File tree

1 file changed

+3
-29
lines changed

1 file changed

+3
-29
lines changed

pkg/connector/workspace.go

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@ import (
55
"fmt"
66

77
v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2"
8-
"github.com/conductorone/baton-sdk/pkg/annotations"
98
"github.com/conductorone/baton-sdk/pkg/types/entitlement"
109
"github.com/conductorone/baton-sdk/pkg/types/grant"
1110
resources "github.com/conductorone/baton-sdk/pkg/types/resource"
1211
"github.com/conductorone/baton-slack/pkg"
1312
"github.com/conductorone/baton-slack/pkg/connector/client"
14-
"github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap"
1513
"github.com/slack-go/slack"
1614
)
1715

@@ -140,31 +138,9 @@ func (o *workspaceResourceType) Grants(
140138
resource *v2.Resource,
141139
attrs resources.SyncOpAttrs,
142140
) ([]*v2.Grant, *resources.SyncOpResults, error) {
143-
l := ctxzap.Extract(ctx)
144-
if o.businessPlusClient == nil {
145-
l.Debug("Business+ client not available, skipping workspace grants")
146-
return nil, &resources.SyncOpResults{}, nil
147-
}
148-
149-
bag, err := pkg.ParsePageToken(attrs.PageToken.Token, &v2.ResourceId{ResourceType: resourceTypeUser.Id})
150-
if err != nil {
151-
return nil, nil, fmt.Errorf("parsing page token: %w", err)
152-
}
153-
154-
outputAnnotations := annotations.New()
155-
users, nextCursor, ratelimitData, err := o.businessPlusClient.GetUsers(
156-
ctx,
157-
resource.Id.Resource,
158-
bag.PageToken(),
159-
)
160-
outputAnnotations.WithRateLimiting(ratelimitData)
141+
users, err := o.client.GetUsers()
161142
if err != nil {
162-
return nil, nil, fmt.Errorf("fetching users for workspace: %w", err)
163-
}
164-
165-
pageToken, err := bag.NextToken(nextCursor)
166-
if err != nil {
167-
return nil, nil, fmt.Errorf("creating next page token: %w", err)
143+
return nil, nil, client.WrapError(err, "fetching users for workspace")
168144
}
169145

170146
var rv []*v2.Grant
@@ -247,9 +223,7 @@ func (o *workspaceResourceType) Grants(
247223
rv = append(rv, grant.NewGrant(resource, memberEntitlement, userID))
248224
}
249225

250-
return rv, &resources.SyncOpResults{
251-
NextPageToken: pageToken,
252-
}, nil
226+
return rv, &resources.SyncOpResults{}, nil
253227
}
254228

255229
// Grant and Revoke are not implemented for workspace membership because they require

0 commit comments

Comments
 (0)