[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 committed 2025-10-13 15:16:11 +02:00
1 parent a4cbc7341d
commit 2a508c4f29
2 files changed
+6

No files matched your search

@@ -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"]
@@ -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
}