-
Notifications
You must be signed in to change notification settings - Fork 3.8k
/
noop.go
38 lines (31 loc) · 1.15 KB
/
noop.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 2023 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.
package tenantcapabilitiesauthorizer
import (
"context"
"github.com/cockroachdb/cockroach/pkg/multitenant/tenantcapabilities"
"github.com/cockroachdb/cockroach/pkg/roachpb"
)
// NoopAuthorizer is a tenantcapabilities.Authorizer that simply no-ops.
type NoopAuthorizer struct{}
// NewNoopAuthorizer constructs and returns a NoopAuthorizer.
func NewNoopAuthorizer() *NoopAuthorizer {
return &NoopAuthorizer{}
}
// HasCapabilityForBatch implements the tenantcapabilities.Authorizer interface.
func (n *NoopAuthorizer) HasCapabilityForBatch(
context.Context, roachpb.TenantID, *roachpb.BatchRequest,
) error {
return nil
}
// BindReader implements the tenantcapabilities.Authorizer interface.
func (n *NoopAuthorizer) BindReader(context.Context, tenantcapabilities.Reader) {
panic("disallowed")
}