I have an organization role in Liferay and in this organization role are users. I want to get this users now. Furthermore I want to specify the organization name of the role.
So is there something like
xxxServiceUtil.getUsersByOrganizationRoleName(String myOrganizationRoleName);
Thank you in advance.
One principle throughout Liferay's API is: If you look for a User
, then you go through UserLocalService
. That's your first hint on where to look.
Since Liferay 7.0, you should not use the *Util
classes any more, but just obtain a @Reference
to the service directly.
Looking at the service, you'll notice that it has a getRoleUsers
method. However, I can't tell you if this also takes Organization-scoped roles or only portal/instance scoped ones. In case it doesn't reveal what you like, you might need to go through getOrganizationUsers
and filter on from there, or start with a DynamicQuery, which you can also find within the same service (following the principle that opened this answer)