留言板

How to get all users assigned to a usergroup

thumbnail
Vishal Panchal,修改在11 年前。

How to get all users assigned to a usergroup

Expert 帖子: 289 加入日期: 12-5-20 最近的帖子
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,修改在11 年前。

RE: How to get all users assigned to a usergroup

Regular Member 帖子: 110 加入日期: 10-9-3 最近的帖子
List<User> users = UserLocalServiceUtil.getUserGroupUsers(userGroupId);
thumbnail
Vishal Panchal,修改在11 年前。

RE: How to get all users assigned to a usergroup

Expert 帖子: 289 加入日期: 12-5-20 最近的帖子
Thanks for the quick response.

It works..!!

Thank you Ivo Alireza Zare.emoticon
thumbnail
Vishal Panchal,修改在11 年前。

RE: How to get all users assigned to a usergroup

Expert 帖子: 289 加入日期: 12-5-20 最近的帖子
Thanks Ivo Ivanov too.
thumbnail
Troy Griffitts,修改在10 年前。

RE: How to get all users assigned to a usergroup

New Member 帖子: 18 加入日期: 11-8-6 最近的帖子
Any idea which jsonws call to use?
thumbnail
Suraj Bihari,修改在10 年前。

RE: How to get all users assigned to a usergroup

Junior Member 帖子: 41 加入日期: 11-5-20 最近的帖子
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,修改在11 年前。

RE: How to get all users assigned to a usergroup

Regular Member 帖子: 191 加入日期: 11-11-25 最近的帖子
Hi,

You can use UserLocalServiceUtil.getUserGroupUsers(groupId) to get the desired users..Hope this helps..
thumbnail
Mazhar Alam,修改在11 年前。

RE: How to get all users assigned to a usergroup

Regular Member 帖子: 191 加入日期: 11-11-25 最近的帖子
Seems you got a quick reply..:-)
thumbnail
Vishal Panchal,修改在11 年前。

RE: How to get all users assigned to a usergroup

Expert 帖子: 289 加入日期: 12-5-20 最近的帖子
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,修改在11 年前。

RE: How to get all users assigned to a usergroup

Regular Member 帖子: 191 加入日期: 11-11-25 最近的帖子
Welcome..:-)
thumbnail
Alireza Zare,修改在11 年前。

RE: How to get all users assigned to a usergroup

Regular Member 帖子: 110 加入日期: 10-9-3 最近的帖子
You are welcome!
Bhavik Shah,修改在8 年前。

RE: How to get all users assigned to a usergroup

Junior Member 帖子: 64 加入日期: 15-5-21 最近的帖子
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());