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);
}