For the union/association/corporation to have a "right" means the government, or anyone else, cannot take action against it; here just because it gives money to another party, including political campaigns.
Rights are not a magic shield that someone owns or doesn't own, it's not a piece of property someone can sign away, it's a statement of fact that identifies when it's lawful to use force to compel someone to do something.
Saying that a corporation can't donate to a political campaign does absolutely nothing to the individual rights of any owner, officer, customer, or nemesis of the corporation.
Um, what about the owners who, you know, own the corporation? The government is telling them they can't do with their property as they see fit. It's a violation of some very real person's rights.
If corporations didn't have rights, how could they be a party in a contract? How could they sue for damages? They have right to not be defrauded, after all. Same thing if they want to give money away. The two concepts are inseperable.
Again, the corporation is formed as an autonomous entity following the rules set by the owners. If a co-owner were to give off corporate assets in violation of this agreement, that's theft, it's a violation of the contract.
And if the government were to take legal action against it for giving away assets in a fashion it doesn't like, that's theft.