Always, except on the Sabbath, of course.
If you want a good laugh, take a look at
Orthodox Jews debating this question.
Everything is a lawsuit to them.
Ask The Rabbi: I was recently sent by an Amuta of sick patients of a rare disease to attend a conference in America. Unfortunately,the main part of the conference took place over Shabbat....I found myself in a toilet on Shabbat morning which to my horror I realized would electrically activate an automatic flushing reaction if I moved out of the toilet booth. I was faced with the dilemma of spending the whole Shabbat in the toilet booth, and thereby wasting all the public funds that had been spent to send me to the conference, or leaving the toilet booth and activating the flushing reaction...
Turns out he was stuck in the toilet for nothing:
"your pure intention is to get back to your room and not to flush the toilet"
They used to do things
the Biblical way:
...when I was growing up in the early 1950’s... there was an “outhouse shack” at the back of the garden which had to be used during the sabbath eve though there was a toilet in the house with running water. Imagine using that place at 2 a.m. in the morning as a 5 year old walking out in pitch black and hearing wild animals howling. It gives me the shakes even today when I think back.
Better to shake than to bake.