Fórum

How to get all users assigned to a usergroup

thumbnail
Vishal Panchal, modificado 11 Anos atrás.

How to get all users assigned to a usergroup

Expert Postagens: 289 Data de Entrada: 20/05/12 Postagens Recentes
Hi all,

I am currently working with liferay-tomcat-6.1.2 GA2.
Now I want to retrieve all users those who assigned to a specific usergroup.

Suppose I have one SmapleUserGroup and 5 users are currently assigned to the same usergroup.
so How can I retrieve all 5 users by using usergroup name(SmapleUserGroup ).


Please guide me to achieve this.

Thanks & Regards,
Vishal R. Panchal
thumbnail
Alireza Zare, modificado 11 Anos atrás.

RE: How to get all users assigned to a usergroup

Regular Member Postagens: 110 Data de Entrada: 03/09/10 Postagens Recentes
List<User> users = UserLocalServiceUtil.getUserGroupUsers(userGroupId);
thumbnail
Vishal Panchal, modificado 11 Anos atrás.

RE: How to get all users assigned to a usergroup

Expert Postagens: 289 Data de Entrada: 20/05/12 Postagens Recentes
Thanks for the quick response.

It works..!!

Thank you Ivo Alireza Zare.emoticon
thumbnail
Vishal Panchal, modificado 11 Anos atrás.

RE: How to get all users assigned to a usergroup

Expert Postagens: 289 Data de Entrada: 20/05/12 Postagens Recentes
Thanks Ivo Ivanov too.
thumbnail
Troy Griffitts, modificado 10 Anos atrás.

RE: How to get all users assigned to a usergroup

New Member Postagens: 18 Data de Entrada: 06/08/11 Postagens Recentes
Any idea which jsonws call to use?
thumbnail
Suraj Bihari, modificado 10 Anos atrás.

RE: How to get all users assigned to a usergroup

Junior Member Postagens: 41 Data de Entrada: 20/05/11 Postagens Recentes
Hi Troy,

Hopefully you already found the answer... here are my two-cents:

There is a complete list available on http://localhost:8080/api/jsonws
In this case is what you are looking for is http://localhost:8080/api/jsonws?signature=%2Fuser%2Fget-user-group-users-1-userGroupId

Enjoy liferay!
Best regards,
Suraj
thumbnail
Mazhar Alam, modificado 11 Anos atrás.

RE: How to get all users assigned to a usergroup

Regular Member Postagens: 191 Data de Entrada: 25/11/11 Postagens Recentes
Hi,

You can use UserLocalServiceUtil.getUserGroupUsers(groupId) to get the desired users..Hope this helps..
thumbnail
Mazhar Alam, modificado 11 Anos atrás.

RE: How to get all users assigned to a usergroup

Regular Member Postagens: 191 Data de Entrada: 25/11/11 Postagens Recentes
Seems you got a quick reply..:-)
thumbnail
Vishal Panchal, modificado 11 Anos atrás.

RE: How to get all users assigned to a usergroup

Expert Postagens: 289 Data de Entrada: 20/05/12 Postagens Recentes
Mazhar Alam:
Seems you got a quick reply..:-)



Hi Mazhar Alam,

Yes I got but even thanks for your valuable reply.emoticon!


Thanks & Regards,
Vishal R. Panchal
thumbnail
Mazhar Alam, modificado 11 Anos atrás.

RE: How to get all users assigned to a usergroup

Regular Member Postagens: 191 Data de Entrada: 25/11/11 Postagens Recentes
Welcome..:-)
thumbnail
Alireza Zare, modificado 11 Anos atrás.

RE: How to get all users assigned to a usergroup

Regular Member Postagens: 110 Data de Entrada: 03/09/10 Postagens Recentes
You are welcome!
Bhavik Shah, modificado 8 Anos atrás.

RE: How to get all users assigned to a usergroup

Junior Member Postagens: 64 Data de Entrada: 21/05/15 Postagens Recentes
To get users from usergroup, please find below is the code snippet:

ThemeDisplay td = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);

UserGroup ug = UserGroupLocalServiceUtil.getUserGroup(td.getCompanyId(), groupName); // get groupName from preference
List<User> listUsers = UserLocalServiceUtil.getUserGroupUsers(ug.getUserGroupId());