Sheriff Villanueva exceeded his authority in rehiring fired deputy, judge rules