a legal resident of the commonwealth may bring an action in superior court to challenge any official or agency of the commonwealth or a county, city, town or other political subdivision of the commonwealth that adopts or implements a policy that limits or restricts the enforcement of federal immigration laws, including 8 U.S.C. sections 1373 and 1644, to less than the full extent permitted by fede