[api] Fix RBAC for listing of TenantNamespaces and handle system:masters

Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
This commit is contained in:
Andrei Kvapil
2025-10-13 15:15:39 +02:00
parent a4cbc7341d
commit 2a508c4f29
2 changed files with 6 additions and 0 deletions

View File

@@ -6,6 +6,9 @@ rules:
- apiGroups: [""]
resources: ["namespaces", "secrets"]
verbs: ["get", "watch", "list"]
- apiGroups: ["rbac.authorization.k8s.io"]
resources: ["rolebindings"]
verbs: ["get", "watch", "list"]
- apiGroups: [""]
resources: ["secrets"]
verbs: ["create", "update", "patch", "delete"]

View File

@@ -272,6 +272,9 @@ func (r *REST) filterAccessible(
for _, group := range u.GetGroups() {
groups[group] = struct{}{}
}
if _, ok = groups["system:masters"]; ok {
return names, nil
}
if _, ok = groups["cozystack-cluster-admin"]; ok {
return names, nil
}