Bug #1610: Fix problem accessing company view with limited permissions

When the user had restricted access to the company view, and the list
of specific projects that he could read is empty, an HibernateQueryException
was being raised.

FEA: ItEr77S04BugFixing
This commit is contained in:
Lorenzo Tilve Álvaro 2013-04-12 18:57:47 +02:00
parent 1d1473b9a5
commit a7adf8429f

View file

@ -442,12 +442,16 @@ public class OrderDAO extends IntegrationEntityDAO<Order> implements
} else { } else {
String strQuery = "SELECT oa.order.id " String strQuery = "SELECT oa.order.id "
+ "FROM OrderAuthorization oa " + "FROM OrderAuthorization oa "
+ "WHERE oa.user = :user " + "WHERE oa.user = :user ";
+ "OR oa.profile IN (:profiles) "; if (!user.getProfiles().isEmpty()) {
strQuery += "OR oa.profile IN (:profiles) ";
}
Query query = getSession().createQuery(strQuery); Query query = getSession().createQuery(strQuery);
query.setParameter("user", user); query.setParameter("user", user);
query.setParameterList("profiles", user.getProfiles()); if (!user.getProfiles().isEmpty()) {
query.setParameterList("profiles", user.getProfiles());
}
return query.list(); return query.list();
} }