Skip to content

Commit

Permalink
accesslist: return "ineligible_status" for all write operations
Browse files Browse the repository at this point in the history
This PR propagates access list members and owner's ineglibile_status
field with the data from the backend. Prior to this change, the field
was ignored.

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
  • Loading branch information
tigrato authored and github-actions committed Jun 5, 2024
1 parent b0c487b commit 047b16d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
16 changes: 9 additions & 7 deletions api/client/accesslist/accesslist.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ func (c *Client) GetAccessLists(ctx context.Context) ([]*accesslist.AccessList,
accessLists := make([]*accesslist.AccessList, len(resp.AccessLists))
for i, accessList := range resp.AccessLists {
var err error
accessLists[i], err = conv.FromProto(accessList)
accessLists[i], err = conv.FromProto(
accessList,
conv.WithOwnersIneligibleStatusField(accessList.GetSpec().GetOwners()))
if err != nil {
return nil, trace.Wrap(err)
}
Expand All @@ -70,7 +72,7 @@ func (c *Client) ListAccessLists(ctx context.Context, pageSize int, nextToken st
accessLists := make([]*accesslist.AccessList, len(resp.AccessLists))
for i, accessList := range resp.AccessLists {
var err error
accessLists[i], err = conv.FromProto(accessList)
accessLists[i], err = conv.FromProto(accessList, conv.WithOwnersIneligibleStatusField(accessList.GetSpec().GetOwners()))
if err != nil {
return nil, "", trace.Wrap(err)
}
Expand Down Expand Up @@ -102,7 +104,7 @@ func (c *Client) GetAccessListsToReview(ctx context.Context) ([]*accesslist.Acce
accessLists := make([]*accesslist.AccessList, len(resp.AccessLists))
for i, accessList := range resp.AccessLists {
var err error
accessLists[i], err = conv.FromProto(accessList)
accessLists[i], err = conv.FromProto(accessList, conv.WithOwnersIneligibleStatusField(accessList.GetSpec().GetOwners()))
if err != nil {
return nil, trace.Wrap(err)
}
Expand All @@ -119,7 +121,7 @@ func (c *Client) UpsertAccessList(ctx context.Context, accessList *accesslist.Ac
if err != nil {
return nil, trace.Wrap(err)
}
responseAccessList, err := conv.FromProto(resp)
responseAccessList, err := conv.FromProto(resp, conv.WithOwnersIneligibleStatusField(resp.GetSpec().GetOwners()))
return responseAccessList, trace.Wrap(err)
}

Expand All @@ -131,7 +133,7 @@ func (c *Client) UpdateAccessList(ctx context.Context, accessList *accesslist.Ac
if err != nil {
return nil, trace.Wrap(err)
}
responseAccessList, err := conv.FromProto(resp)
responseAccessList, err := conv.FromProto(resp, conv.WithOwnersIneligibleStatusField(resp.GetSpec().GetOwners()))
return responseAccessList, trace.Wrap(err)
}

Expand Down Expand Up @@ -227,7 +229,7 @@ func (c *Client) UpsertAccessListMember(ctx context.Context, member *accesslist.
if err != nil {
return nil, trace.Wrap(err)
}
responseMember, err := conv.FromMemberProto(resp)
responseMember, err := conv.FromMemberProto(resp, conv.WithMemberIneligibleStatusField(resp))
return responseMember, trace.Wrap(err)
}

Expand All @@ -239,7 +241,7 @@ func (c *Client) UpdateAccessListMember(ctx context.Context, member *accesslist.
if err != nil {
return nil, trace.Wrap(err)
}
responseMember, err := conv.FromMemberProto(resp)
responseMember, err := conv.FromMemberProto(resp, conv.WithMemberIneligibleStatusField(resp))
return responseMember, trace.Wrap(err)
}

Expand Down
10 changes: 8 additions & 2 deletions api/client/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,10 @@ func EventFromGRPC(in *proto.Event) (*types.Event, error) {
out.Resource = r
return &out, nil
} else if r := in.GetAccessList(); r != nil {
out.Resource, err = accesslistv1conv.FromProto(r)
out.Resource, err = accesslistv1conv.FromProto(
r,
accesslistv1conv.WithOwnersIneligibleStatusField(r.GetSpec().GetOwners()),
)
if err != nil {
return nil, trace.Wrap(err)
}
Expand All @@ -431,7 +434,10 @@ func EventFromGRPC(in *proto.Event) (*types.Event, error) {
}
return &out, nil
} else if r := in.GetAccessListMember(); r != nil {
out.Resource, err = accesslistv1conv.FromMemberProto(r)
out.Resource, err = accesslistv1conv.FromMemberProto(
r,
accesslistv1conv.WithMemberIneligibleStatusField(r),
)
if err != nil {
return nil, trace.Wrap(err)
}
Expand Down
2 changes: 1 addition & 1 deletion api/types/accesslist/convert/v1/member.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func FromMembersProto(msgs []*accesslistv1.Member) ([]*accesslist.AccessListMemb
members := make([]*accesslist.AccessListMember, len(msgs))
for i, msg := range msgs {
var err error
members[i], err = FromMemberProto(msg)
members[i], err = FromMemberProto(msg, WithMemberIneligibleStatusField(msg))
if err != nil {
return nil, trace.Wrap(err)
}
Expand Down

0 comments on commit 047b16d

Please sign in to comment.