Fórum
Check if User is a member of Current Group
Guru k, modificado 11 Anos atrás.
Check if User is a member of Current Group
Junior Member Postagens: 64 Data de Entrada: 08/02/12 Postagens Recentes
Hi,
I am trying to check if the logged in user is a member of Current group and if he is not a member of the group redirect him to a different page.
But, how to check if the logged in user is a member of Current group.
Thanks
I am trying to check if the logged in user is a member of Current group and if he is not a member of the group redirect him to a different page.
But, how to check if the logged in user is a member of Current group.
Thanks
Ibrahim Mahammad, modificado 11 Anos atrás.
RE: Check if User is a member of Current Group
Junior Member Postagens: 47 Data de Entrada: 30/11/11 Postagens Recentes
Check the below link
http://www.liferay.com/community/forums/-/message_boards/message/3174245
http://www.liferay.com/community/forums/-/message_boards/message/3174245
Sandip Patel, modificado 11 Anos atrás.
RE: Check if User is a member of Current Group
Regular Member Postagens: 205 Data de Entrada: 05/01/11 Postagens Recentes
Hi,
You have to get all Groups, of which user is member, and check current group is in that list or not.
For get all groups of user use below codes,
User u =null;
List<User > userGroupList = u.getGroupIds();
You have to get all Groups, of which user is member, and check current group is in that list or not.
For get all groups of user use below codes,
User u =null;
List<User > userGroupList = u.getGroupIds();
Jitendra Rajput, modificado 11 Anos atrás.
RE: Check if User is a member of Current Group
Liferay Master Postagens: 875 Data de Entrada: 07/01/11 Postagens Recentes
You can try with this
Above method will return true if user is part of that current group
UserLocalServiceUtil.hasGroupUser(themeDisplay.getScopeGroupId(), themeDisplay.getUserId())
Above method will return true if user is part of that current group
Guru k, modificado 11 Anos atrás.
RE: Check if User is a member of Current Group
Junior Member Postagens: 64 Data de Entrada: 08/02/12 Postagens Recentes
Thanks for the Replies...
Got it working
Got it working
Subhash Shah, modificado 11 Anos atrás.
RE: Check if User is a member of Current Group
Junior Member Postagens: 78 Data de Entrada: 30/11/11 Postagens Recentes
Alternatively, you can use following method:
GroupLocalServiceUtil.hasUserGroup(userId, groupId);
GroupLocalServiceUtil.hasUserGroup(userId, groupId);