Remember, nobody has the right to beat anyone. Be it school or street or home. But you see, it was like tradition to punish student in class while teaching. Punishment could be of any kind (physical or mental). Earlier teachers were dedicated for development of students but now things have changed a lot. Now teachers do not have any interest in kids education but in salary ony. They beat students just for the sake of their frustration.
Beating is neither legal nor it is morally correct.