Judge rules for deputies in lawsuit