From 81d077e6bb0fc1a30922d927763995c3a59d85bf Mon Sep 17 00:00:00 2001 From: Trent Clarke Date: Tue, 19 Mar 2024 17:35:00 +1100 Subject: [PATCH] Implements ResourceWithLabels on AccessListMember (#39498) * Implements ResourceWithLabels on AccessListMember * Update member.go --- api/types/accesslist/member.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/api/types/accesslist/member.go b/api/types/accesslist/member.go index 20bdaafac10b5..6562a691b3048 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,10 @@ func (a *AccessListMember) IsEqual(other *AccessListMember) bool { return a.Spec.Name == other.Spec.Name && a.Spec.AccessList == other.Spec.AccessList } + +// 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) +}