Skip to content

Commit

Permalink
Continue if principal is nil in resource set binding grants (#57)
Browse files Browse the repository at this point in the history
* continue if principal is nil

* comma
  • Loading branch information
laurenleach authored Nov 22, 2024
1 parent 47fab30 commit 6099539
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/connector/resource_sets_bindings.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,12 @@ func (rsb *resourceSetsBindingsResourceType) Entitlements(_ context.Context, res

// listMembersOfBinding. List all Role Resource Set Binding Members
// https://developer.okta.com/docs/api/openapi/okta-management/management/tag/RoleDResourceSetBindingMember/#tag/RoleDResourceSetBindingMember/operation/listMembersOfBinding
func (rsb *resourceSetsBindingsResourceType) listMembersOfBinding(ctx context.Context,
func (rsb *resourceSetsBindingsResourceType) listMembersOfBinding(
ctx context.Context,
client *okta.Client,
resourceSetId, customRoleId string,
_ *query.Params) ([]MembersDetails, *okta.Response, error) {
_ *query.Params,
) ([]MembersDetails, *okta.Response, error) {
apiPath, err := url.JoinPath(apiPathListIamResourceSets, resourceSetId, "bindings", customRoleId, "members")
if err != nil {
return nil, nil, err
Expand Down Expand Up @@ -230,6 +232,10 @@ func (rsb *resourceSetsBindingsResourceType) Grants(ctx context.Context, resourc
principal = &v2.Resource{Id: &v2.ResourceId{ResourceType: resourceTypeGroup.Id, Resource: resourceId}}
}

if principal == nil {
continue
}

gr := sdkGrant.NewGrant(resource, entitlementName, principal,
sdkGrant.WithAnnotation(&v2.V1Identifier{
Id: fmtGrantIdV1(V1MembershipEntitlementID(resource.Id.Resource), resource.Id.Resource),
Expand Down

0 comments on commit 6099539

Please sign in to comment.