From 3a07e18e982ecab88d509c4364c6544dd872db28 Mon Sep 17 00:00:00 2001 From: Zeort Date: Mon, 30 Sep 2024 16:21:02 +0300 Subject: [PATCH] fix sap.ids prefix --- controllers/cfapi_auth.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/controllers/cfapi_auth.go b/controllers/cfapi_auth.go index 4f7e7eb..b9486eb 100644 --- a/controllers/cfapi_auth.go +++ b/controllers/cfapi_auth.go @@ -69,11 +69,13 @@ func (r *CFAPIReconciler) assignCfAdministrators(ctx context.Context, subjects [ } } + oids_subjects := make([]rbacv1.Subject, len(_subjects)) //add prefix sap.ids: for all user names without prefix - for _, subject := range _subjects { + for i, subject := range _subjects { if subject.Kind == "User" && !strings.HasPrefix(subject.Name, OIDC_USER_PREFIX) { subject.Name = OIDC_USER_PREFIX + subject.Name } + oids_subjects[i] = subject } rb := &rbacv1.RoleBinding{ @@ -89,7 +91,7 @@ func (r *CFAPIReconciler) assignCfAdministrators(ctx context.Context, subjects [ Kind: "ClusterRole", Name: "korifi-controllers-admin", }, - Subjects: _subjects, + Subjects: oids_subjects, } userNames := make([]string, len(_subjects))