All these states and counties and cities have
managed to pass gun legislation based on
some Constitutional criteria,
Answering my own question, here is the quote from USC 18, Part I,
chapter 44, section 922, paragraph (q)(1)(I)
http://www4.law.cornell.edu/uscode/html/uscode18/usc_sec_18_00000922----000-.html
'(I) the Congress has the power, under the interstate commerce clause
and other provisions of the Constitution, to enact measures to ensure
the integrity and safety of the Nation's schools by enactment of this
subsection.'
It's the battle between regulating commerce and the right to bear arms.