It is obligatory for you to listen to the ruler and obey him in adversity and prosperity, in pleasure and displeasure, and even when another person is given (rather undue) preference over you. (Using translation from Muslim 1836)
أَنَّ رَسُولَ اللهِ ﷺ قَالَ عَلَيْكَ السَّمْعَ وَالطَّاعَةَ فِي عُسْرِكَ وَيُسْرِكَ وَمَنْشَطِكَ وَمَكْرَهِكَ وَأَثَرَةٍ عَلَيْكَ قَالَ قُتَيْبَةُ الطَّاعَةُ وَلَمْ يَقُلْ السَّمْعَ