OpenStack: Allow user access to tanent projects

Get mgmt user data
# get user ID and domain ID
MGMT_USER_ID=$(openstack user list --long -c ID -c Name -f value | grep | cut -d" " -f1)
echo ${MGMT_USER_ID}

# get projects
openstack project list --long | grep safyievOokEgavUtdytPeurmebKowEff

# get assignments
openstack role assignment list --user JekUvyeijHaDrithWianvestUtevLiUk --project e72c94c20b4d40e3b971bc510d536e87 --names

# get Domain name
openstack domain list | grep safyievOokEgavUtdytPeurmebKowEff

Search tanent data
# get user domain ID
openstack domain list | grep yrgsonova

# get user id
openstack user list --long | grep 6dac5139fa41465e89766746cec640e4

# get project id
openstack project list --long | grep 6dac5139fa41465e89766746cec640e4

# get assignments
openstack role assignment list --user 0749e19d1af349509c7941fd2d60a358 --project odWejBicHajIvtakeytPiUsGeJajyood --names

Add user to tanent project
openstack role add --user JekUvyeijHaDrithWianvestUtevLiUk --project odWejBicHajIvtakeytPiUsGeJajyood member
openstack role add --user JekUvyeijHaDrithWianvestUtevLiUk --project odWejBicHajIvtakeytPiUsGeJajyood domadmin
openstack role add --user JekUvyeijHaDrithWianvestUtevLiUk --project odWejBicHajIvtakeytPiUsGeJajyood heat_stack_owner
openstack role add --user JekUvyeijHaDrithWianvestUtevLiUk --project odWejBicHajIvtakeytPiUsGeJajyood load-balancer_member
openstack role assignment list --user JekUvyeijHaDrithWianvestUtevLiUk --project odWejBicHajIvtakeytPiUsGeJajyood --names

Remove user access to tanent projects
# get assigned projects
openstack project list --user ${MGMT_USER_ID}

USER_ID=JekUvyeijHaDrithWianvestUtevLiUk
PROJECT_ID=odWejBicHajIvtakeytPiUsGeJajyood

ROLES="
member
domadmin
heat_stack_owner
load-balancer_member
"

for ROLE in ${ROLES}; do
openstack role remove --user ${USER_ID} --project ${PROJECT_ID} ${ROLE}
done

openstack role assignment list --user ${USER_ID} --project ${PROJECT_ID} --names

Links
https://docs.openstack.org/keystone/latest/admin/cli-manage-projects-users-and-roles.html