From de88345c0aac2371075bf78a52e024071dab064b Mon Sep 17 00:00:00 2001 From: Trent Clarke Date: Wed, 20 Mar 2024 01:20:23 +1100 Subject: [PATCH] [v15] Implements ResourceWithLabels on AccessListMember (#39551) * 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) +}