It doesn't at the present time.
Until the Supreme Court says that the 2nd amendment also applies to state and local governments, and is not just a restriction on the federal government, then it doesn't apply to actions by the NYC authorities.
That's just the plain legal reality of the situation, and criticising reality is important, but has limited value.