MCPcopy
hub / github.com/grpc/grpc-go / newPolicyMatcher

Function newPolicyMatcher

internal/xds/rbac/matchers.go:51–64  ·  view source on GitHub ↗
(policy *v3rbacpb.Policy)

Source from the content-addressed store, hash-verified

49}
50
51func newPolicyMatcher(policy *v3rbacpb.Policy) (*policyMatcher, error) {
52 permissions, err := matchersFromPermissions(policy.Permissions)
53 if err != nil {
54 return nil, err
55 }
56 principals, err := matchersFromPrincipals(policy.Principals)
57 if err != nil {
58 return nil, err
59 }
60 return &policyMatcher{
61 permissions: &orMatcher{matchers: permissions},
62 principals: &orMatcher{matchers: principals},
63 }, nil
64}
65
66func (pm *policyMatcher) match(data *rpcData) bool {
67 // A policy matches if and only if at least one of its permissions match the

Callers 1

newEngineFunction · 0.85

Calls 2

matchersFromPermissionsFunction · 0.85
matchersFromPrincipalsFunction · 0.85

Tested by

no test coverage detected