1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-04-08 10:04:25 +00:00

fix principal and role variables are not substituted (#5000)

This commit is contained in:
Vyankatesh Kudtarkar 2022-10-17 10:46:14 +05:30 committed by GitHub
parent ea1b64ab08
commit f3e40efcd7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,9 @@
package utils
import (
"encoding/json"
"strings"
kyvernov1 "github.com/kyverno/kyverno/api/kyverno/v1"
kyvernov1beta1 "github.com/kyverno/kyverno/api/kyverno/v1beta1"
"github.com/kyverno/kyverno/pkg/autogen"
@ -51,6 +54,14 @@ func checkForRBACInfo(rule kyvernov1.Rule) bool {
}
}
}
if bytes, err := json.Marshal(rule); err != nil {
return false
} else {
if strings.Contains(string(bytes), "request.roles") || strings.Contains(string(bytes), "request.clusterRoles") {
return true
}
}
return false
}