/** * Determines whether a user can access an organisation unit, based on the organisation units to * which the user has been assigned. * * @param user user to test * @param source organisation unit to which the user may have access * @return whether the user has acceess to the organisation unit */ private boolean canUserAccessSource(User user, OrganisationUnit source) { for (OrganisationUnit o : user.getOrganisationUnits()) { if (source == o || source.getAncestors().contains(o)) { return true; } } return false; }