Fórum
How to get count of users for specific role
Sadanand Ghadage, modificado 7 Anos atrás.
How to get count of users for specific role
New Member Postagens: 23 Data de Entrada: 26/12/14 Postagens Recentes
Hi Guys,
In my requirement, I have to calculate the number of users associated with a particular role in a site. Any pointers would be helpful..
I am using Liferay 6.2 CE GA5.
Thanks in advance.
Regards,
Sadanand
In my requirement, I have to calculate the number of users associated with a particular role in a site. Any pointers would be helpful..
I am using Liferay 6.2 CE GA5.
Thanks in advance.
Regards,
Sadanand
Pankaj Kathiriya, modificado 7 Anos atrás.
RE: How to get count of users for specific role
Liferay Master Postagens: 722 Data de Entrada: 05/08/10 Postagens Recentes
You could use below API method to get user count for particular role based on roleId and status..
Please note that Role can be assigned to Team, UserGroups etc; so I am not sure if above method returns that count too. You may investigate it further.
/**
* Returns the number of users with the status belonging to the role.
*
* @param roleId the primary key of the role
* @param status the workflow status
* @return the number of users with the status belonging to the role */
UserLocalServiceUtil.getRoleUsersCount(long roleId, int status)
Please note that Role can be assigned to Team, UserGroups etc; so I am not sure if above method returns that count too. You may investigate it further.
Sadanand Ghadage, modificado 7 Anos atrás.
RE: How to get count of users for specific role
New Member Postagens: 23 Data de Entrada: 26/12/14 Postagens Recentes
Thanks Pankaj for your reply.
But still no luck. I am getting '0' as a return value. Any other solution ?
Regards,
Sadanand
But still no luck. I am getting '0' as a return value. Any other solution ?
Regards,
Sadanand
Pankaj Kathiriya, modificado 7 Anos atrás.
RE: How to get count of users for specific role
Liferay Master Postagens: 722 Data de Entrada: 05/08/10 Postagens Recentes
Let us know what exact thing; you have tried? Also, give information on how Role is assigned to user.