Skip to content

Commit

Permalink
Fix namespace interceptor to allow search attributes operations (#3899)
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigozhou authored Feb 3, 2023
1 parent d43e112 commit e95e082
Show file tree
Hide file tree
Showing 4 changed files with 188 additions and 87 deletions.
170 changes: 85 additions & 85 deletions api/adminservice/v1/request_response.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions common/rpc/interceptor/namespace_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ import (
"context"

enumspb "go.temporal.io/api/enums/v1"
"go.temporal.io/api/operatorservice/v1"
"go.temporal.io/api/serviceerror"
"go.temporal.io/api/workflowservice/v1"
"google.golang.org/grpc"

"go.temporal.io/server/api/adminservice/v1"
"go.temporal.io/server/common"
"go.temporal.io/server/common/dynamicconfig"
"go.temporal.io/server/common/namespace"
Expand Down Expand Up @@ -178,6 +180,18 @@ func (ni *NamespaceValidatorInterceptor) extractNamespaceFromRequest(req interfa
return nil, errNamespaceNotSet
}
return nil, nil
case *adminservice.AddSearchAttributesRequest,
*adminservice.RemoveSearchAttributesRequest,
*adminservice.GetSearchAttributesRequest,
*operatorservice.AddSearchAttributesRequest,
*operatorservice.RemoveSearchAttributesRequest,
*operatorservice.ListSearchAttributesRequest:
// Namespace is optional for search attributes operations.
// It's required when using SQL DB for visibility, but not when using Elasticsearch.
if !namespaceName.IsEmpty() {
return ni.namespaceRegistry.GetNamespace(namespaceName)
}
return nil, nil
default:
// All other APIs.
if namespaceName.IsEmpty() {
Expand Down
Loading

0 comments on commit e95e082

Please sign in to comment.