According to the first amendment, the answer is: students have the right to protest political views. Schools can punish students, but not for expressing their political views. So, No. Public schools cannot ban political protests.
In the case, the punishment was not fair to those who were not guilty. But that was not the point. This punishment was applied to the entire senior due to the senior prank, as no one had admited the wrong doing. School have the right to apply the punishment in the case, with an administrative penalty / punishment. School cannot apply punishment due to a student protest, at this very case, it would be unconstitutional.