diff --git a/pkg/services/apiserver/auth/authorizer/org_id.go b/pkg/services/apiserver/auth/authorizer/org_id.go index e9d4a6786a8..f73d3b59b32 100644 --- a/pkg/services/apiserver/auth/authorizer/org_id.go +++ b/pkg/services/apiserver/auth/authorizer/org_id.go @@ -37,11 +37,15 @@ func (auth orgIDAuthorizer) Authorize(ctx context.Context, a authorizer.Attribut return authorizer.DecisionDeny, fmt.Sprintf("error reading namespace: %v", err), nil } - // No opinion when the namespace is arbitrary - if info.OrgID == -1 { + // No opinion when the namespace is empty + if info.Value == "" { return authorizer.DecisionNoOpinion, "", nil } + if info.OrgID == -1 { + return authorizer.DecisionDeny, "org id is required", nil + } + if info.StackID != "" { return authorizer.DecisionDeny, "using a stack namespace requires deployment with a fixed stack id", nil } diff --git a/pkg/services/apiserver/auth/authorizer/stack_id.go b/pkg/services/apiserver/auth/authorizer/stack_id.go index 0098c1dfd21..da63c25d5ba 100644 --- a/pkg/services/apiserver/auth/authorizer/stack_id.go +++ b/pkg/services/apiserver/auth/authorizer/stack_id.go @@ -37,8 +37,8 @@ func (auth stackIDAuthorizer) Authorize(ctx context.Context, a authorizer.Attrib return authorizer.DecisionDeny, fmt.Sprintf("error reading namespace: %v", err), nil } - // No opinion when the namespace is arbitrary - if info.OrgID == -1 { + // No opinion when the namespace is empty + if info.Value == "" { return authorizer.DecisionNoOpinion, "", nil }