Skip to content

Commit

Permalink
Fixed early return bug (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
loganintech authored Dec 11, 2023
1 parent 9daeec8 commit 221bee7
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions pkg/connector/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ import (
resourceSdk "github.com/conductorone/baton-sdk/pkg/types/resource"
)

const (
accountMemberEntitlement = "member"
)

type accountResourceType struct {
resourceType *v2.ResourceType
orgClient *awsOrgs.Client
Expand Down Expand Up @@ -111,7 +107,6 @@ func (o *accountResourceType) Entitlements(ctx context.Context, resource *v2.Res
if err != nil {
return nil, "", nil, fmt.Errorf("aws-connector: getPermissionSets failed: %w", err)
}

rv := make([]*v2.Entitlement, 0, len(allPS))
for _, ps := range allPS {
b := &PermissionSetBinding{
Expand All @@ -122,14 +117,15 @@ func (o *accountResourceType) Entitlements(ctx context.Context, resource *v2.Res
annos.Update(&v2.V1Identifier{
Id: b.String(),
})
member := entitlementSdk.NewAssignmentEntitlement(resource, accountMemberEntitlement,
displayName := fmt.Sprintf("%s Permission Set", awsSdk.ToString(ps.Name))
member := entitlementSdk.NewAssignmentEntitlement(resource, displayName,
entitlementSdk.WithGrantableTo(resourceTypeSSOUser, resourceTypeSSOGroup),
)
member.Description = awsSdk.ToString(ps.Description)
member.Annotations = annos
member.Id = b.String()
member.DisplayName = fmt.Sprintf("%s Permission Set", awsSdk.ToString(ps.Name))
return []*v2.Entitlement{member}, "", nil, nil
member.Slug = fmt.Sprintf("%s access", awsSdk.ToString(ps.Name))
rv = append(rv, member)
}
return rv, "", nil, nil
}
Expand Down Expand Up @@ -453,7 +449,6 @@ func (o *accountResourceType) getPermissionSets(ctx context.Context) ([]*awsSsoA
}
o._permissionSetsCache = append(o._permissionSetsCache, ps)
}

return o._permissionSetsCache, nil
}

Expand Down

0 comments on commit 221bee7

Please sign in to comment.