What is the best way (with fewest API calls) to get all projects a user is a member of in Horizon project?

asked 2014-02-13 17:46:27 -0600

vahidhashemian gravatar image

I have a user id and want to get a list of all projects this user is currently a member of. I can't find a single API call that gives me that. So I was wondering if I'm missing it, and if not, how I can get the list in the most efficient way. Thanks.

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted

answered 2014-02-13 18:01:16 -0600

vahidhashemian gravatar image

Forgot to mention I needed this for V2.

edit flag offensive delete link more

answered 2014-02-13 21:10:37 -0600

lin-hua-cheng gravatar image

Unfortunately, it cannot be done in a single call.

If you have the user credentials, you can use its token and just make a single call to /tenants. The returns you the list of project associated with the user token.

If you have the admin token, and only have the user_id: 1. Get all the projects: /tenants 2. Iterate through each project and see if the user has any role in it: /tenants/<project_id>/users/<user_id>/roles

edit flag offensive delete link more

answered 2014-02-13 21:17:37 -0600

vahidhashemian gravatar image

Thanks Lin Hua Cheng, that solved my question.

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2014-02-13 17:46:27 -0600

Seen: 182 times

Last updated: Feb 13 '14