Skip to main content
Browse Documentation

Get group membership for a user

Created by Alex Pop on 04 Aug 2020

Gets the groups the user is a member of by passing the user id or a UserGroupsOptions object as an argument.

getUserGroupsuserIdOrOptions: string | UserGroupsOptions): Promise<PagedList<Group>>

Example for direct parent groups

let userId = "4b262379-5bbe-421e-a429-f6e2ab5a849b";

client.security.users.getUserGroups(userId)
    .then(result => {
        console.log('API call result: ', result);
    })
    .catch(error => {
        console.log('API call error: ', error);        
    });

Example for inherited parent groups

let options = {
    userId: "4b262379-5bbe-421e-a429-f6e2ab5a849b",
    includeInherited: true
};

client.security.users.getUserGroups(options)
    .then(result => {
        console.log('API call result: ', result);
    })
    .catch(error => {
        console.log('API call error: ', error);        
    });