From 505aef5e7e94097457941b10b8b8ab33a9c38926 Mon Sep 17 00:00:00 2001 From: Rajaditya Chauhan Date: Thu, 16 Nov 2023 12:25:18 +0530 Subject: [PATCH] RBAC: adding type in management_principal table --- opl/rbac_populate.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/opl/rbac_populate.py b/opl/rbac_populate.py index f01cc48..b38e435 100644 --- a/opl/rbac_populate.py +++ b/opl/rbac_populate.py @@ -178,10 +178,11 @@ def add_roles_to_group(url_base, x_rh_identity, role_list, group_uuid): def create_principal(cursor, account): user_uuid = str(uuid.uuid4()) user_name = "user-" + user_uuid + user_type = "user" logging.info(f"Creating principal username = {user_name}") cursor.execute( - "INSERT INTO public.management_principal (uuid, username, tenant_id) VALUES (%s, %s, (SELECT id FROM public.api_tenant WHERE tenant_name = 'acct' || %s)) RETURNING id", - (user_uuid, user_name, account), + "INSERT INTO public.management_principal (uuid, username, tenant_id) VALUES (%s, %s, (SELECT id FROM public.api_tenant WHERE tenant_name = 'acct' || %s), %s) RETURNING id", + (user_uuid, user_name, account, user_type), ) user_id = cursor.fetchone()[0] return user_name, user_id