All officers, agents, commissioners and other persons acting, or who have acted, for and on behalf of any county, town, village or municipal corporation in this state, and each and every one of them, may be prosecuted, and an action may be maintained against them to prevent any illegal official act on the part of any such officers, agents, commissioners or other persons, or to prevent waste or injury to, or to restore and make good, any property, funds or estate of such county, town, village or municipal corporation by any person or corporation whose assessment, or by any number of persons or corporations, jointly, the sum of whose assessments shall amount to one thousand dollars, and who shall be liable to pay taxes on such assessment in the county, town, village or municipal corporation or by any person who owns shares in a cooperative housing corporation where the pro rata share of the assessment attributable to such shares shall amount to one thousand dollars (or by any number of such persons, jointly, the sum of whose pro rata shares shall amount to one thousand dollars) and where the cooperative housing corporation shall be liable to pay taxes on such assessment in the county, town, village or municipal corporation to prevent the waste or injury of whose property the action is brought, or who have been assessed or paid taxes therein upon any assessment of the above-named amount within one year previous to the commencement of any such action, or who has been so assessed but has not paid nor shall be liable to pay any or the full amount of taxes on such assessment because of a veteran’s exemption therefrom pursuant to Real Property Tax Law § 458 (Veterans)section four hundred fifty-eight of the real property tax law, or who has been so assessed but has not paid nor shall be liable to pay any or the full amount of taxes on such assessment because of an exemption therefrom granted to persons sixty-five years of age or over or their spouses pursuant to the real property tax law. Such person or corporation upon the commencement of such action, shall furnish a bond to the defendant therein, to be approved by a justice of the supreme court or the county judge of the county in which the action is brought, in such penalty as the justice or judge approving the same shall direct, but not less than two hundred and fifty dollars, and to be executed by any two of the plaintiffs, if there be more than one party plaintiff, providing said two parties plaintiff shall severally justify in the sum of five thousand dollars. Said bond shall be approved by said justice or judge and be conditioned to pay all costs that may be awarded the defendant in such action if the court shall finally determine the same in favor of the defendant. The court shall require, when the plaintiffs shall not justify as above mentioned, and in any case may require two more sufficient sureties to execute the bond above provided for. Such bond shall be filed in the office of the county clerk of the county in which the action is brought, and a copy shall be served with the summons in such action. If an injunction is obtained as herein provided for, the same bond may also provide for the payment of the damages arising therefrom to the party entitled to the money, the auditing, allowing or paying of which was enjoined, if the court shall finally determine that the plaintiff is not entitled to such injunction. In case the waste or injury complained of consists in any board, officer or agent in any county, town, village or municipal corporation, by collusion or otherwise, contracting, auditing, allowing or paying, or conniving at the contracting, audit, allowance or payment of any fraudulent, illegal, unjust or inequitable claims, demands or expenses, or any item or part thereof against or by such county, town, village or municipal corporation, or by permitting a judgment to be recovered against such county, town, village or municipal corporation, or against himself in his official capacity, either by default or without the interposition and proper presentation of any existing legal or equitable defenses, or by any such officer or agent, retaining or failing to pay over to the proper authorities any funds or property of any county, town, village or municipal corporation, after he shall have ceased to be such officer or agent, the court may, in its discretion, prohibit the payment or collection of any such claims, demands, expenses or judgments, in whole or in part, and shall enforce the restitution and recovery thereof, if heretofore or hereafter paid, collected or retained by the person or party heretofore or hereafter receiving or retaining the same, and also may, in its discretion, adjudge and declare the colluding or defaulting official personally responsible therefor, and out of his property, and that of his bondsmen, if any, provide for the collection or repayment thereof, so as to indemnify and save harmless the said county, town, village or municipal corporation from a part or the whole thereof; and in case of a judgment the court may in its discretion, vacate, set aside and open said judgment, with leave and direction for the defendant therein to interpose and enforce any existing legal or equitable defense therein, under the direction of such person as the court may, in its judgment or order, designate and appoint. All books of minutes, entry or account, and the books, bills, vouchers, checks, contracts or other papers connected with or used or filed in the office of, or with any officer, board or commission acting for or on behalf of any county, town, village or municipal corporation in this state or any body corporate or other unit of local government in this state which possesses the power to levy taxes or benefit assessments upon real estate or to require the levy of such taxes or assessments or for which taxes or benefit assessments upon real estate may be required pursuant to law to be levied, including the Albany port district commission, are hereby declared to be public records, and shall be open during all regular business hours, subject to reasonable regulations to be adopted by the applicable local legislative body, to the inspection of any taxpayer or registered voter, who may copy, photograph or make photocopies thereof on the premises where such records are regularly kept. This section shall not be so construed as to take away any right of action from any county, town, village or municipal corporation, or from any public officer, but any right of action now existing, or which may hereafter exist in favor of any county, town, village or municipal corporation, or in favor of any officer thereof, may be enforced by action or otherwise by the persons hereinbefore authorized to prosecute and maintain actions; and whenever by the provisions of this section an action may be prosecuted or maintained against any officer or other person, his bondsmen, if any, may be joined in such action or proceeding and their liabilities as such enforced by the proper judgment or direction of the court; but any recovery under the provisions of this article shall be for the benefit of and shall be paid to the officer entitled by law to hold and disburse the public moneys of such county, town, village or municipal corporation, and shall, to the amount thereof, be credited the defendant in determining his liability in the action by the county, town, village or municipal corporation or public officer. The provisions of this article shall apply as well to those cases in which the body, board, officer, agent, commissioner or other person above named has not, as to those in which it or he has jurisdiction over the subject-matter of its action.