get all users from group

cancel
Showing results for 
Search instead for 
Did you mean: 
Member II

get all users from group

Hello

How can I get all users from group (example GROUP_test_1 ) and inner groups (example GROUP_test_1_1)? 

This code:

authorityService.getContainedAuthorities(AuthorityType.USER, "GROUP_test_1 ", true)

return only users from group GROUP_test_1, ignore users from GROUP_test_1_1.

 

1 Reply
Moderator
Moderator

Re: get all users from group


authorityService.getContainedAuthorities(AuthorityType.USER, "GROUP_test_1 ", true)

return only users from group GROUP_test_1, ignore users from GROUP_test_1_1.

 


Seems you are using wrong flag, the last parameter should be false.

final Set<String> users = authorityService.getContainedAuthorities(AuthorityType.USER, "GROUP_test_1", false);

The last flag is whether to get immediate users or in-depth user:

immediate --> if true, limit the depth to just immediate child, if false find authorities at any depth
~Abhinav
(ACSCE, AWS SAA-C02, GAIQ)