The action provided for in this chapter may be maintained by the board of supervisors of any county or city and county or the legislative body of any municipal corporation, respectively, in the name of such county, city and county or municipal corporation against any person who usurps, intrudes into or unlawfully holds or exercises any franchise, or portion thereof, within the respective territorial limits of such county, city and county or municipal corporation and which is of a kind that is within the jurisdiction of such board or body to grant or withhold.