"That the action of state courts and judicial officers in their official capacities is to be regarded as action of the State within the meaning of the Fourteenth Amendment, is a proposition which has long been established by decisions of this Court." - Shelley v. Kraemer, 334 U.S. 1, 14 (1948).

Now this case dealt with racially restrictive covenants on the sale of real estate property so it's different but a judicial order is state action.

A court order for specific performance or injunction that directed that you were not to possess firearms in your apartment would seem to me to be a judicial order that flies in the face of Heller.

Further the question would come up whether or not that particular covenant in the lease was dependent or independent. I have a hard time coming up with a rationale making it a dependent covenant.

I doubt the LL would get specific performance or an injunction and therefore could sue for damages.