This code works well for me, provided that Order entity has a reference to Group:
public class OrderEdit extends AbstractEditor<Order> {
@Inject
private UserSession userSession;
@Override
protected void initNewItem(Order item) {
item.setGroup(userSession.getUser().getGroup());
}
}
If I add {E}.group.id = :session$userGroupId security constraint to the Order entity, orders will be available only for users from the same group as a user which created them.
I have tried {E}.group.id = :session$userGroupId to filter some orders out, and it works well to me. But I have the orders list in customer edit window, in this list, I still see all the orders there, can I do the same thing to this orders list? how?