Foren

Getting all users reporting to a manager

Gaurav Sharma, geändert vor 11 Jahren.

Getting all users reporting to a manager

Junior Member Beiträge: 39 Beitrittsdatum: 01.11.12 Neueste Beiträge
I've created a tree hierarchy of users by using the "Organization" feature of Liferay CE. So, there is a "Company "org. under which there is a "Sales Team" org. Under that, there is a "Sales Managers" org. There is a user assigned to the "Sales Managers" org. Under the "Sales Managers" org., there is a "Salesmen" org. and that has users assigned as well.

So, to summarize:

Company->Sales->Sales Managers->Salesmen

I'd like to display all "salesmen" when the "Sales Manager" logs in. What would be the best way to do this?
thumbnail
Barrie Selack, geändert vor 11 Jahren.

RE: Getting all users reporting to a manager (Antwort)

New Member Beiträge: 3 Beitrittsdatum: 11.06.10 Neueste Beiträge
UserLocalServiceUtil has a method to return all users in an organization.

	/**
	* Returns all the users belonging to the organization.
	*
	* @param organizationId the primary key of the organization
	* @return the users belonging to the organization
	* @throws SystemException if a system exception occurred
	*/
	public static java.util.List<com.liferay.portal.model.user> getOrganizationUsers(
		long organizationId)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getService().getOrganizationUsers(organizationId);
	}
</com.liferay.portal.model.user>
thumbnail
Barrie Selack, geändert vor 11 Jahren.

RE: Getting all users reporting to a manager (Antwort)

New Member Beiträge: 3 Beitrittsdatum: 11.06.10 Neueste Beiträge
If you want to get the organizations under another organization, you can use

	/**
	* Returns all the organizations belonging to the parent organization.
	*
	* @param companyId the primary key of the organization's company
	* @param parentOrganizationId the primary key of the organization's parent
	organization
	* @return the organizations belonging to the parent organization
	* @throws SystemException if a system exception occurred
	*/
	public static java.util.List<com.liferay.portal.model.organization> getOrganizations(
		long companyId, long parentOrganizationId)
		throws com.liferay.portal.kernel.exception.SystemException {
		return getService().getOrganizations(companyId, parentOrganizationId);
	}
</com.liferay.portal.model.organization>


in OrganizationLocalServiceUtil