'Whenever, by priority of possession, rights to the use of water for mining, agricultural, manufacturing or other purposes, have vested, and accrued, and the same are recognized and acknowledged by the local customs, laws and the decisions of courts, the possessors and owners of such vested rights shall be maintained and protected in the same; and the right of way for the construction of ditches a