A district may commence, maintain, intervene in, and compromise, in the name of the district, any action or proceeding involving or affecting the ownership or use of water or water rights within the district, used or useful for any purpose of the district, or a common benefit to lands within the district or inhabitants of the district.