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

accesslist: return "ineligible_status" for all write operations #42474

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -440,7 +440,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 @@ -452,7 +455,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
Loading