Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
Vishal Panchal
How to get all users assigned to a usergroup
19. September 2012 23:35
Antwort

Vishal Panchal

Rang: Expert

Nachrichten: 280

Eintrittsdatum: 20. Mai 2012

Neue Beiträge

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
Alireza Zare
RE: How to get all users assigned to a usergroup
19. September 2012 23:50
Antwort

Alireza Zare

Rang: Regular Member

Nachrichten: 110

Eintrittsdatum: 3. September 2010

Neue Beiträge

List<User> users = UserLocalServiceUtil.getUserGroupUsers(userGroupId);
Vishal Panchal
RE: How to get all users assigned to a usergroup
19. September 2012 23:52
Antwort

Vishal Panchal

Rang: Expert

Nachrichten: 280

Eintrittsdatum: 20. Mai 2012

Neue Beiträge

Thanks for the quick response.

It works..!!

Thank you Ivo Alireza Zare.emoticon
Vishal Panchal
RE: How to get all users assigned to a usergroup
19. September 2012 23:53
Antwort

Vishal Panchal

Rang: Expert

Nachrichten: 280

Eintrittsdatum: 20. Mai 2012

Neue Beiträge

Thanks Ivo Ivanov too.
Mazhar Alam
RE: How to get all users assigned to a usergroup
20. September 2012 00:01
Antwort

Mazhar Alam

Rang: Regular Member

Nachrichten: 201

Eintrittsdatum: 25. November 2011

Neue Beiträge

Hi,

You can use UserLocalServiceUtil.getUserGroupUsers(groupId) to get the desired users..Hope this helps..
Mazhar Alam
RE: How to get all users assigned to a usergroup
20. September 2012 00:03
Antwort

Mazhar Alam

Rang: Regular Member

Nachrichten: 201

Eintrittsdatum: 25. November 2011

Neue Beiträge

Seems you got a quick reply..:-)
Vishal Panchal
RE: How to get all users assigned to a usergroup
20. September 2012 00:25
Antwort

Vishal Panchal

Rang: Expert

Nachrichten: 280

Eintrittsdatum: 20. Mai 2012

Neue Beiträge

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
Mazhar Alam
RE: How to get all users assigned to a usergroup
20. September 2012 05:10
Antwort

Mazhar Alam

Rang: Regular Member

Nachrichten: 201

Eintrittsdatum: 25. November 2011

Neue Beiträge

Welcome..:-)
Alireza Zare
RE: How to get all users assigned to a usergroup
20. September 2012 12:42
Antwort

Alireza Zare

Rang: Regular Member

Nachrichten: 110

Eintrittsdatum: 3. September 2010

Neue Beiträge

You are welcome!
Troy Griffitts
RE: How to get all users assigned to a usergroup
18. Juli 2013 07:25
Antwort

Troy Griffitts

Rang: New Member

Nachrichten: 18

Eintrittsdatum: 6. August 2011

Neue Beiträge

Any idea which jsonws call to use?
Suraj Bihari
RE: How to get all users assigned to a usergroup
13. November 2013 13:55
Antwort

Suraj Bihari

Rang: Junior Member

Nachrichten: 42

Eintrittsdatum: 20. Mai 2011

Neue Beiträge

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
Bhavik Shah
RE: How to get all users assigned to a usergroup
24. Mai 2015 22:36
Antwort

Bhavik Shah

Rang: New Member

Nachrichten: 19

Eintrittsdatum: 20. Mai 2015

Neue Beiträge

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());