Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RBAC: adding type in management_principal table #98

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions opl/rbac_populate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down