Retrieving User Object from UserGrant

Hey there, I am facing a problem in retrieving the User behind the UserGrant Object. As far as I understand, I can retrieve the User from the UserGrant object using the user_id property, as shown in the first picture. However, I have two problems: Firstly, I cannot compare the user_id to the id of the User Object because there is no SearchQuery (I am not aware of any other way to do this yet). Secondly, I tried to retrieve the user by comparing it with the UserName of each object, but I can only compare one username at a time. I tried creating a list of queries and adding it to the ListUsers method, but it doesn't work with multiple queries. Am I doing something wrong here? Is there a way to retrieve the users without having to perform a query for each object, as it is very time-consuming and would result in many database calls?
No description
No description
7 Replies
fabienne
fabienne3y ago
Hei @boblack_zocker, we do have a search users request: https://zitadel.com/docs/apis/proto/management#listusersrequest
ZITADEL Docs
This document reflects the state from API 1.0 (available from 20.04.2021)
fabienne
fabienne3y ago
It is currently not possible to get the whole user back in the user grant.
boblack_zocker
boblack_zockerOP3y ago
Hello @fabienne, thanks for the response. This method is known to me but I had a problem with this method too. As you can see in my screenshot I can not use the function as I thought it would work. For a better explanation: I have a list of UserGrants from where I have to retrieve the User Objects. I tried to add every user into the queries property of ListUsersRequest (you can see this in my screenshot) so I only get the users I need but this does not work. The only two options I have are the following: get every user by not giving any queries OR I use the method with only 1 query (One user at a time) till I get every user. Both opportunities are not the best. At the first I get to much data and at the second it takes to much time. Is that currently a bug or is it not meant to work as I though?
fabienne
fabienne3y ago
At the moment it works as intended. We started with some filters in the listuser query we think are useful If you like some other filters it would be great if you could create an issue in the github repository. We prioritize issues higher if there is a need for a lot of people.
boblack_zocker
boblack_zockerOP3y ago
Aha okey thanks a lot @fabienne . So did I get this right? How I wanted to use the method in my screenshot is not how it is supposed to work, right?
fabienne
fabienne3y ago
yes correctly
boblack_zocker
boblack_zockerOP3y ago
Okey thanks for your answer 😁

Did you find this page helpful?