Cal. Bus. & Prof. Code § 22949.66
(a) A defendant against whom an action is brought under Section 22949.65 does not have standing to assert the right of another individual to keep and bear arms under the Second Amendment to the United States Constitution as a defense to liability under that section unless either of the following is true:
(b) A defendant in an action brought under Section 22949.65 may assert an affirmative defense to liability under this section if both of the following are true: