(policy *v3rbacpb.Policy)
| 49 | } |
| 50 | |
| 51 | func 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 | |
| 66 | func (pm *policyMatcher) match(data *rpcData) bool { |
| 67 | // A policy matches if and only if at least one of its permissions match the |
no test coverage detected