Which legislation level and body governs the ability of students and teachers to carry firearms on a campus? Where does this body derive said authority?
Is it at the city, state, or federal level or a combination of these?
Generally, the Second Amendment, so the argument goes, guarantees American citizens the right to bear arms, aka carry firearms.
State laws vary by state. California, Iowa, Maryland, Minnesota, New Jersey, and New York are the only states that do not have a provision in their state constitutions mirroring or significantly reflecting the provisions of the Second Amendment (although New York has a civil rights law containing something almost the same as the Second Amendment).
Campus carry laws are also decided at the state level. There are three types:
Mandatory: requires publicly funded schools to, in general, allow on-campus carrying (even though certain locations, such as a basketball game, may nonetheless bar weapons).
Institutional: each school determines whether or not to allow firearms. These policies are subordinate to state law according to, for example, court holdings in Colorado and Oregon, and as stated by the University of Texas.
Non-permissive: the law, with some exceptions, bans firearms on any institution's property.
SCOTUS has held in McDonald v. City of Chicago that the Second Amendment applies to state and local laws and, thus, state and local laws are limited in the same way that federal laws are limited with respect to an individual's right to keep and bear arms. It had previously already held that the Second Amendment protects an individual's right to own guns in District of Columbia v. Heller.
Currently it’s left at the state legislative level to decide whether to allow or not allow the concealed carrying of firearms on campus.
Some states, however, leave this decision up to the individual institutions.
In 2017, two states passed legislation to allow students and faculty to carry guns on college campuses, Arkansas and Georgia.
tl;dr: In theory, all three levels potentially have jurisdiction. In practice, carrying on or near primary or secondary school property is banned at the federal level, while individual states define the rules for carrying weapons on college or university campuses.
In theory, the federal government, a state government, or a local government could pass such a law, provided that it's not superseded by a law at a higher level. It's possible to have laws at all three levels, provided the laws at the lower levels don't contradict those at the higher levels. For more information on how jurisdiction generally works between levels of the federal government, see this question.
In practice, the federal Gun-Free School Zones Act of 1990 (GFSZA) makes it a federal crime for anyone (with a few defined exceptions) to carry firearms on the property of or on non-private property within 1,000 feet of the property of a primary or secondary school, regardless of whether the school is public, private, or parochial.
This is codified in 18 USC 922 (q)(2), which states:
(A) It shall be unlawful for any individual knowingly to possess a firearm that has moved in or that otherwise affects interstate or foreign commerce at a place that the individual knows, or has reasonable cause to believe, is a school zone.
(B) Subparagraph (A) does not apply to the possession of a firearm—
(i) on private property not part of school grounds;
(ii) if the individual possessing the firearm is licensed to do so by the State in which the school zone is located or a political subdivision of the State, and the law of the State or political subdivision requires that, before an individual obtains such a license, the law enforcement authorities of the State or political subdivision verify that the individual is qualified under law to receive the license;
(iii) that is—
(I) not loaded; and
(II) in a locked container, or a locked firearms rack that is on a motor vehicle;
(iv) by an individual for use in a program approved by a school in the school zone;
(v) by an individual in accordance with a contract entered into between a school in the school zone and the individual or an employer of the individual;
(vi) by a law enforcement officer acting in his or her official capacity; or
(vii) that is unloaded and is possessed by an individual while traversing school premises for the purpose of gaining access to public or private lands open to hunting, if the entry on school premises is authorized by school authorities.
Additionally, 18 USC 922(q)(3) makes it a separate federal crime to "knowingly or with reckless disregard for the safety of another... discharge a firearm" in a primary or secondary school zone, also with a few relatively narrow listed exceptions.
Furthermore, the federal Gun-Free Schools Act of 1994 requires states receiving federal education funding (i.e. all of them) to have a state law that requires their public school districts to expel any student who brings a firearm to school or possesses one at school for a period of at least 1 year. This is codified in 20 USC 7961.
It's additionally worth noting that the presence of a federal law here doesn't mean that states or municipalities can't also make and enforce equally or more restrictive laws. Indeed, GFSZA specifically states that it should not be interpreted to prevent states from making laws with additional restrictions. So, while federal criminal charges can be brought under the federal laws, states can also create their own criminal laws and bring charges under those if they so choose.
According to the Giffords Law Center to Prevent Gun Violence's section on federal laws on gun laws for schools (granted, a biased source, but a relatively thorough one,)
No federal law restricts guns on college or university campuses.
However, according to their section on state laws,
Most states either prohibit or restrict firearms on college or university campuses, or allow those institutions to set their own rules banning firearms.
This section of their website also contains a table listing the restrictions by state.