"A well regulated Militia, being necessary to the security of a free State,
the right of the people to keep and bear Arms, shall not be infringed."
The 2nd Amendment grants gun access to residents of the United States, but this access has certain limitations which have been recognized by multiple judicial decisions and practices. Note that the phrase 'the people' in the Amendment does not qualify such individuals but it is accepted that government authorities can restrict the 'right' to bear arms to individuals who meet certain legal criteria which cover various behaviors, such as commission of certain crimes, dependency on addictive substances, flight from certain legal jurisdictions, treatment for mental illness and other disqualifying behaviors and personal histories.
The government also can impose conditions for ownership of certain types of weapons based on whether such weapons represent a level of lethality which might constitute a threat to community safety. So, for example, fully-automatic weapons can be purchased and owned, but the process of acquiring such weapons involves a much greater intervention on the part of licensing authorities, and state jurisdictions can also impose additional licensing requirements above and beyond what is required under federal law.
Even though the assault weapons ban that was enacted in 1994 expired in 2003, certain states renewed the ban and residents of those states have no 2nd-Amendment 'right' to possess or purchase such guns. In 2013 the city of Highland Park outside of Chicago passed a municipal ordinance prohibiting the ownership of assault rifles by any resident, and this law did not exempt the ownership of such guns that had been acquired prior to the ban. The courts have long agreed that we have a 'compelling interest' in community safety which allows us to determine what types of products might represent a threat to community safety and thus take the necessary measures to control such products, up to and including banning them from everyday use.
The 2nd Amendment isn't a 'right.' The 2nd Amendment is an amendment. To define what 'rights' are guaranteed by the Constitution and of its Amendments, Congress enacts laws. In fact, Congress has enacted four laws defining what we can and cannot do with guns. These laws were enacted in 1934, 1938, 1968 and 1994. When someone says they have a 'God-given right' to defend themselves from an attack or a threat, this divine sanction has absolutely nothing to do with the ownership or use of guns at all.