From d3746adb03806c9fc81bd2122788c534ed1b9f07 Mon Sep 17 00:00:00 2001 From: Trent Clarke Date: Mon, 18 Mar 2024 12:46:12 +0000 Subject: [PATCH 1/2] Implements ResourceWithLabels on AccessListMember --- api/types/accesslist/member.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/api/types/accesslist/member.go b/api/types/accesslist/member.go index 20bdaafac10b5..c3423bebe63b7 100644 --- a/api/types/accesslist/member.go +++ b/api/types/accesslist/member.go @@ -24,6 +24,7 @@ import ( "github.com/gravitational/teleport/api/types" "github.com/gravitational/teleport/api/types/header" "github.com/gravitational/teleport/api/types/header/convert/legacy" + "github.com/gravitational/teleport/api/utils" ) // AccessListMember is an access list member resource. @@ -116,3 +117,13 @@ func (a *AccessListMember) IsEqual(other *AccessListMember) bool { return a.Spec.Name == other.Spec.Name && a.Spec.AccessList == other.Spec.AccessList } + +var _ types.ResourceWithOrigin = (*AccessListMember)(nil) +var _ types.ResourceWithLabels = (*AccessListMember)(nil) + +// MatchSearch goes through select field values of a resource +// and tries to match against the list of search values. +func (a *AccessListMember) MatchSearch(values []string) bool { + fieldVals := append(utils.MapToStrings(a.GetAllLabels()), a.GetName()) + return types.MatchSearch(fieldVals, values, nil) +} From 01bb1615ffdbdaa54b263ebda930903d2434a094 Mon Sep 17 00:00:00 2001 From: Trent Clarke Date: Tue, 19 Mar 2024 09:06:38 +1100 Subject: [PATCH 2/2] Update member.go --- api/types/accesslist/member.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/api/types/accesslist/member.go b/api/types/accesslist/member.go index c3423bebe63b7..6562a691b3048 100644 --- a/api/types/accesslist/member.go +++ b/api/types/accesslist/member.go @@ -118,9 +118,6 @@ func (a *AccessListMember) IsEqual(other *AccessListMember) bool { a.Spec.AccessList == other.Spec.AccessList } -var _ types.ResourceWithOrigin = (*AccessListMember)(nil) -var _ types.ResourceWithLabels = (*AccessListMember)(nil) - // MatchSearch goes through select field values of a resource // and tries to match against the list of search values. func (a *AccessListMember) MatchSearch(values []string) bool {