When does civil disobedience become legitimate

I asked the Taoiseach when he thought civil disobedience became legitimate if democracy is reduced to a tyranny of a narrow majority.