diff --git a/authorize/databroker.go b/authorize/databroker.go index 928494c5c..e0e278f8e 100644 --- a/authorize/databroker.go +++ b/authorize/databroker.go @@ -3,11 +3,10 @@ package authorize import ( "context" - "github.com/open-policy-agent/opa/storage" - "github.com/pomerium/pomerium/internal/telemetry/trace" "github.com/pomerium/pomerium/pkg/grpc/session" "github.com/pomerium/pomerium/pkg/grpc/user" + "github.com/pomerium/pomerium/pkg/storage" ) type sessionOrServiceAccount interface { diff --git a/pkg/storage/storage.go b/pkg/storage/storage.go index 24df7df9a..e83d8b3a3 100644 --- a/pkg/storage/storage.go +++ b/pkg/storage/storage.go @@ -113,3 +113,8 @@ func matchProtoMapValue(fd protoreflect.FieldDescriptor, m protoreflect.Map, que }) return matches } + +// IsNotFound returns true if the error is because a record was not found. +func IsNotFound(err error) bool { + return errors.Is(err, ErrNotFound) || status.Code(err) == codes.NotFound +}