Foros de discusión
Check if user has custom organization role
Laura Riveros, modificado hace 9 años.
Check if user has custom organization role
New Member Mensajes: 5 Fecha de incorporación: 1/08/14 Mensajes recientes
Hi,
I want to know if a user has an organization role that I just created. I have tried with:
None of the above give the specific organization role that I want.
Thank you,
Laura
I want to know if a user has an organization role that I just created. I have tried with:
RoleLocalServiceUtil.getUserRoles(user.getUserId())
RoleLocalServiceUtil.getUserRelatedRoles(user.getUserId(), 14601
RoleLocalServiceUtil.getUserGroupRoles(user.getUserId(), 14601)
user.getRoleIds()
None of the above give the specific organization role that I want.
Thank you,
Laura
Pankaj Kathiriya, modificado hace 9 años.
RE: Check if user has custom organization role
Liferay Master Mensajes: 722 Fecha de incorporación: 5/08/10 Mensajes recientes
Use UserGroupRoleLocalServiceUtil.java utility class to check if user has particular organization role or not.
You can utliize hasUserGroupRole(long userId, long groupId, String roleName) or hasUserGroupRole(long userId, long groupId, long roleId) methods where groupId will be organization's groupId.
Regards,
You can utliize hasUserGroupRole(long userId, long groupId, String roleName) or hasUserGroupRole(long userId, long groupId, long roleId) methods where groupId will be organization's groupId.
Regards,
Laura Riveros, modificado hace 9 años.
RE: Check if user has custom organization role
New Member Mensajes: 5 Fecha de incorporación: 1/08/14 Mensajes recientes
I just tried your suggestion hasUserGroupRole(long userId, long groupId, long roleId) where groupId is the organization's groupId. It worked!
Thanks for your help!
Thanks for your help!