Organization Administrator and Organization Owner
In Liferay, we can assign the users to the Organization and can assign the Organization role to the users. There are 3 types of organization roles . After assigning the role , If we want to fetch the users who has the Organization administartor. Below is the code. long orgId = ParamUtil.getLong(request, "organizationId"); List<User> users = OrganizationUtil.getUsers(orgId); Group organizationGroup = OrganizationLocalServiceUtil.getOrganization(orgId).getGroup(); for(User user: users){ long organizationGroupId = organizationGroup.getGroupId(); if (UserGroupRoleLocalServiceUtil.hasUserGroupRole( user.getUserId(), organizationGroupId, RoleConstants.ORGANIZATION_ADMINISTRATOR)) { System.out.println("User is: "+ user); ...