The judge said that the ban violated the state constitution’s right to privacy provision.