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

enterprise grid support #11

Merged
merged 1 commit into from
Feb 22, 2024
Merged

Conversation

jakcinmarina
Copy link
Contributor

No description provided.

@@ -102,7 +116,7 @@ func (o *workspaceResourceType) Entitlements(ctx context.Context, resource *v2.R
}

func (o *workspaceResourceType) Grants(ctx context.Context, resource *v2.Resource, pt *pagination.Token) ([]*v2.Grant, string, annotations.Annotations, error) {
users, err := o.client.GetUsersContext(ctx)
users, err := o.client.GetUsersContext(ctx, slack.GetUsersOptionTeamID(resource.Id.Resource))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're not an org client does this still work? Does passing the param where it's not needed "just work" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep it will ignore it :)

@@ -84,7 +100,7 @@ func (o *userGroupResourceType) Entitlements(ctx context.Context, resource *v2.R
}

func (o *userGroupResourceType) Grants(ctx context.Context, resource *v2.Resource, pt *pagination.Token) ([]*v2.Grant, string, annotations.Annotations, error) {
groupMembers, err := o.client.GetUserGroupMembers(resource.Id.Resource)
groupMembers, err := o.enterpriseClient.GetUserGroupMembers(ctx, resource.Id.Resource, resource.ParentResourceId.Resource)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this always work or does it need treatment like the code on lines 61-72 checking o.enterpriseId? Does the enterprise client work for non-enterprise workspaces?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah it works even for non-enterprise workspaces, however I should probably rename it, I initially created it to work with enterprise stuff, but turned out I needed to add more web api stuff in here as well

Comment on lines +89 to +93
if !ok {
return nil, fmt.Errorf("invalid system or organization roleID: %s", roleID)
} else {
roleName = orgRoleName
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if !ok {
return nil, fmt.Errorf("invalid system or organization roleID: %s", roleID)
} else {
roleName = orgRoleName
}
if !ok {
return nil, fmt.Errorf("invalid system or organization roleID: %s", roleID)
}
roleName = orgRoleName

Copy link
Contributor

@loganintech loganintech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I've had my questions answered in other ways. At the very least this works in all my testing, so I'll approve. Thanks for this :)

@jakcinmarina
Copy link
Contributor Author

jakcinmarina commented Feb 22, 2024

@loganintech sorry, I just got to the comments this morning. Glad it works as expected! Can I merge it in that case? I will do the fixes in following PR that will handle SCIM api and provisioning, along with any other stuff that might be needed for full enterprise grid experience :)

@loganintech
Copy link
Contributor

No worries, time differences are a thing. The only reason I didn't merge it myself is if the were any other things you wanted to add or change before we did. The code looks good and my testing was good so if you're happy with it I say go go go.

@jakcinmarina
Copy link
Contributor Author

alright, in that case let's merge it since it has the fix for the customers, and I can add any additional stuff in follow up PR :) thank you!

@jakcinmarina jakcinmarina merged commit 3cef7f5 into main Feb 22, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants