How to get Groups from UserId?

I want to obtain the user ID that accesses the workshop screen and impose access restrictions based on the group to which the user belongs.

I have confirmed that it is possible to obtain the user ID of the accessing user in the workshop settings, but I was unable to retrieve the user’s group in the workshop. Therefore, I am thinking of writing a function that retrieves the group from the user ID and returns true if the user belongs to a specific group.

However, I am not sure how to write the code to create a function that can retrieve the group from the user ID.

I wad going to make function as follows, but it did not work. Could you please tell me how to retrieve the group from the user ID?

private async getGroupNamesByUserId(userId: string): Promise<string> {
const groups = await Users.getGroupById(userId);
console.log(groups);
return groups?.map((group: Group) => group.name);
}

Hi, you can do this via string arrays of Multipass attributes, see this answer: https://community.palantir.com/t/personal-accessibility-on-workshop/1517/2

Overall, the supported endpoints are available in the public documentation, feel free to have a look there if you’re looking for something specific!

https://www.palantir.com/docs/foundry/api/general/overview/getting-started/