mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-09 17:37:12 +00:00
19 lines
419 B
Go
19 lines
419 B
Go
|
package checker
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
)
|
||
|
|
||
|
func Check(ctx context.Context, checker AuthChecker, group, version, resource, subresource, namespace string, verbs ...string) (bool, error) {
|
||
|
for _, verb := range verbs {
|
||
|
result, err := checker.Check(ctx, group, version, resource, subresource, namespace, verb)
|
||
|
if err != nil {
|
||
|
return false, err
|
||
|
}
|
||
|
if !result.Allowed {
|
||
|
return false, nil
|
||
|
}
|
||
|
}
|
||
|
return true, nil
|
||
|
}
|