cancel
Showing results for 
Search instead for 
Did you mean: 

get all users from group

sergus_dev
Confirmed Champ
Confirmed Champ

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 1

abhinavmishra14
World-Class Innovator
World-Class Innovator

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, Azure Admin)