How to efficiently check the number of assigned roles and role details for a TAS (Tanzu Application Service) user.
search cancel

How to efficiently check the number of assigned roles and role details for a TAS (Tanzu Application Service) user.

book

Article ID: 400158

calendar_today

Updated On:

Products

VMware Tanzu Application Service

Issue/Introduction

Operators need to assign User roles after creating a user in TAS (Tanzu Application Service) and might want to know the number of assigned roles for a specific user. 

Resolution

How to efficiently calculate the total number of assigned roles for a specific user?

1. Retrieve the GUID for the selected user. 

$ cf curl /v3/users | jq '.resources[] | select(.username=="<USER-NAME>")' | jq '.guid'
"SOME-GUID"

2. Get the total number of assigned roles for the selected user.

$ cf curl /v3/roles | jq '.resources[].relationships.user.data.guid' | grep "<SOME-GUID>" | wc -l

 

How to quickly retrieve the assigned role names for a specific user?

$ cf curl /v3/roles | jq '.resources[] | select(.relationships.user.data.guid=="<SOME-GUID>")' | jq '.type'
"organization_manager"
"space_manager"
"organization_user"
"space_developer"
"space_auditor"