Foros de discusión

How to get all users assigned to a usergroup

thumbnail
Vishal Panchal, modificado hace 11 años.

How to get all users assigned to a usergroup

Expert Mensajes: 289 Fecha de incorporación: 20/05/12 Mensajes recientes
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 hace 11 años.

RE: How to get all users assigned to a usergroup

Regular Member Mensajes: 110 Fecha de incorporación: 3/09/10 Mensajes recientes
List<User> users = UserLocalServiceUtil.getUserGroupUsers(userGroupId);
thumbnail
Vishal Panchal, modificado hace 11 años.

RE: How to get all users assigned to a usergroup

Expert Mensajes: 289 Fecha de incorporación: 20/05/12 Mensajes recientes
Thanks for the quick response.

It works..!!

Thank you Ivo Alireza Zare.emoticon
thumbnail
Vishal Panchal, modificado hace 11 años.

RE: How to get all users assigned to a usergroup

Expert Mensajes: 289 Fecha de incorporación: 20/05/12 Mensajes recientes
Thanks Ivo Ivanov too.
thumbnail
Troy Griffitts, modificado hace 10 años.

RE: How to get all users assigned to a usergroup

New Member Mensajes: 18 Fecha de incorporación: 6/08/11 Mensajes recientes
Any idea which jsonws call to use?
thumbnail
Suraj Bihari, modificado hace 10 años.

RE: How to get all users assigned to a usergroup

Junior Member Mensajes: 41 Fecha de incorporación: 20/05/11 Mensajes recientes
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 hace 11 años.

RE: How to get all users assigned to a usergroup

Regular Member Mensajes: 191 Fecha de incorporación: 25/11/11 Mensajes recientes
Hi,

You can use UserLocalServiceUtil.getUserGroupUsers(groupId) to get the desired users..Hope this helps..
thumbnail
Mazhar Alam, modificado hace 11 años.

RE: How to get all users assigned to a usergroup

Regular Member Mensajes: 191 Fecha de incorporación: 25/11/11 Mensajes recientes
Seems you got a quick reply..:-)
thumbnail
Vishal Panchal, modificado hace 11 años.

RE: How to get all users assigned to a usergroup

Expert Mensajes: 289 Fecha de incorporación: 20/05/12 Mensajes recientes
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 hace 11 años.

RE: How to get all users assigned to a usergroup

Regular Member Mensajes: 191 Fecha de incorporación: 25/11/11 Mensajes recientes
Welcome..:-)
thumbnail
Alireza Zare, modificado hace 11 años.

RE: How to get all users assigned to a usergroup

Regular Member Mensajes: 110 Fecha de incorporación: 3/09/10 Mensajes recientes
You are welcome!
Bhavik Shah, modificado hace 8 años.

RE: How to get all users assigned to a usergroup

Junior Member Mensajes: 64 Fecha de incorporación: 21/05/15 Mensajes recientes
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());