Fóruns

Início » Liferay Portal » English » 3. Development

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
praveen orvakanti
Getting 'null' while i retrieve the list of users in a Group - Liferay 6API
14 de Março de 2012 09:06
Resposta

praveen orvakanti

Ranking: Junior Member

Mensagens: 51

Data de entrada: 10 de Agosto de 2011

Mensagens recentes

Hi All,
I'm trying to retrieve the list of users belonging to a Group. I'm using Liferay 6.0.5 API. The following are the different API i used to retrieve the list of users in a Group:
>>>> long[] userIds = UserServiceHttp.getGroupUserIds(httpPrincipal, groupCollabId);
>>>> List<com.liferay.portal.model.User> users = UserLocalServiceUtil.getGroupUsers(groupId);

I have double checked and verified the groupId. Is there something that I'm missing?

Thanks,
Ronnie
Amos Fong
RE: Getting 'null' while i retrieve the list of users in a Group - Liferay
14 de Março de 2012 23:34
Resposta

Amos Fong

LIFERAY STAFF

Ranking: Liferay Legend

Mensagens: 1912

Data de entrada: 7 de Outubro de 2008

Mensagens recentes

This looks correct. However, when you say belonging to a "group", do you specifically mean a community? Because there are other methods for different entities (which have a corresponding "group") like organizations and usergroups. Maybe this is the method you want? This is a UserGroup which is different from Group.

1UserLocalServiceUtil.getUserGroupUsers(long userGroupId)
praveen orvakanti
RE: Getting 'null' while i retrieve the list of users in a Group - Liferay
15 de Março de 2012 06:09
Resposta

praveen orvakanti

Ranking: Junior Member

Mensagens: 51

Data de entrada: 10 de Agosto de 2011

Mensagens recentes

Hi Amos,
Thx for the reply.

I'm not looking in a particular 'UserGroup'. I have a portal Instance 'ABC'. Inside that poratal instance, i have a created a couple of Organizations, lets say, 'ABC1' and 'ABC2'. I have aalso created a bunch of users.

Now i want to get the list of users that are part of the group 'ABC1'. How do i get it?

Thanks & Regards
Mahendra Mahakle
RE: Getting 'null' while i retrieve the list of users in a Group - Liferay
15 de Março de 2012 06:42
Resposta

Mahendra Mahakle

Ranking: Junior Member

Mensagens: 81

Data de entrada: 14 de Março de 2011

Mensagens recentes

Hi Praveen,
If you have organization ABC1 "groupId" then you can use following method to get the list of user(s) from ABC1.

UserLocalServiceUtil.getOrganizationUsers(GroupLocalServiceUtil.getGroup(groupId).getOrganizationId());

OR
If you have only "groupId" and you don't know it's user group or Organization group then you can use following code....
List<User> users=null;
if(GroupLocalServiceUtil.getGroup(groupId).isOrganization())
{
users= UserLocalServiceUtil.getOrganizationUsers(GroupLocalServiceUtil.getGroup(groupId).getOrganizationId());
}
else if(GroupLocalServiceUtil.getGroup(groupId).isUser())
{
users=UserLocalServiceUtil.getUserGroupUsers(groupId);
}
praveen orvakanti
RE: Getting 'null' while i retrieve the list of users in a Group - Liferay
15 de Março de 2012 08:42
Resposta

praveen orvakanti

Ranking: Junior Member

Mensagens: 51

Data de entrada: 10 de Agosto de 2011

Mensagens recentes

Thx a lot Mahendra,
That worked emoticon