My apartment manager shuts off the water in the building sometimes several times a month, and always lists "building repairs" as the reason. However, he never elaborates on what the repairs are, and this has happened so consistently over several years, I suspect that he is just trying to reduce water bills. Is this legal? It is very inconvenient to not have water for 7 hours every few weeks or so.
No, this is not legal under California law.
A rental dwelling might be considered "uninhabitable" if it substantially lacks plumbing facilities in good working order, including hot and cold running water, connected to a sewage disposal system. (California Civil Code section 1941.1.)