diff --git a/api/types/access_request.go b/api/types/access_request.go index 517f7d3f8b098..c682b262e441d 100644 --- a/api/types/access_request.go +++ b/api/types/access_request.go @@ -598,6 +598,11 @@ func (s AccessReview) GetAccessListTitle() string { return s.AccessList.Title } +// IsEqual t is equivalent to the provide AccessReviewThreshold. +func (t *AccessReviewThreshold) IsEqual(o *AccessReviewThreshold) bool { + return deriveTeleportEqualAccessReviewThreshold(t, o) +} + // AccessRequestUpdate encompasses the parameters of a // SetAccessRequestState call. type AccessRequestUpdate struct { diff --git a/api/types/derived.gen.go b/api/types/derived.gen.go index 05eeb4b135467..aabfee5b87965 100644 --- a/api/types/derived.gen.go +++ b/api/types/derived.gen.go @@ -6,6 +6,16 @@ import ( "bytes" ) +// deriveTeleportEqualAccessReviewThreshold returns whether this and that are equal. +func deriveTeleportEqualAccessReviewThreshold(this, that *AccessReviewThreshold) bool { + return (this == nil && that == nil) || + this != nil && that != nil && + this.Name == that.Name && + this.Filter == that.Filter && + this.Approve == that.Approve && + this.Deny == that.Deny +} + // deriveTeleportEqualAppV3 returns whether this and that are equal. func deriveTeleportEqualAppV3(this, that *AppV3) bool { return (this == nil && that == nil) || diff --git a/lib/services/access_request.go b/lib/services/access_request.go index 2c78aacad0cbb..4de491ecdcc05 100644 --- a/lib/services/access_request.go +++ b/lib/services/access_request.go @@ -26,7 +26,6 @@ import ( "strings" "time" - "github.com/google/go-cmp/cmp" "github.com/google/uuid" "github.com/gravitational/trace" "github.com/jonboulle/clockwork" @@ -1630,7 +1629,7 @@ func (c *thresholdCollector) pushThreshold(t types.AccessReviewThreshold) (uint3 // don't bother double-storing equivalent thresholds for i, threshold := range c.Thresholds { - if cmp.Equal(t, threshold) { + if t.IsEqual(&threshold) { return uint32(i), nil } }