As recently as the late 1980's, most schools didn't even bother locking the doors during the day, you could just wander in if you wanted. I even remember a stray dog got in the building and was wandering around one day in my grade school.
Compared with today. I go to see my nephews school program. Do I just go in and see the program. Nope.........
They have you sign in, put the name of the student your there for, they hold an ID (yes, hold the ID, not just look at it, they hold on to it when your in the building). They also ask the name of the teacher (which I didn't know of course, so that delayed my entry). That is after they have buzzed you in the building to the office (an exterior door that has clearly been recently installed). Thankfully it was only his grade level, I can't imagine the line for a whole school program.
Would all of this stop a gunman?
Not a chance. It only ensures the first victim is the school secretary (like at Newton).